Fix usage of QMutexLocker, destroy it only at end of scope

Change-Id: I87f2c433c987b5f7b4680639cae51cdf6ce9ddc6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Sérgio Martins 2016-01-10 23:44:20 +00:00 committed by Sérgio Martins
parent e395bda9a5
commit 2c9f6b1a18
2 changed files with 5 additions and 5 deletions

View File

@ -165,7 +165,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
// now look for a thread to insert
bool found = false;
foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {
QMutexLocker(&(thread->mutex));
QMutexLocker locker(&(thread->mutex));
if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) {
DEBUG() << "Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath()
<< "to existing thread " << thread;

View File

@ -737,7 +737,7 @@ inline QUrl QWindowsFileDialogSharedData::directory() const
inline void QWindowsFileDialogSharedData::setDirectory(const QUrl &d)
{
QMutexLocker (&m_data->mutex);
QMutexLocker locker(&m_data->mutex);
m_data->directory = d;
}
@ -751,7 +751,7 @@ inline QString QWindowsFileDialogSharedData::selectedNameFilter() const
inline void QWindowsFileDialogSharedData::setSelectedNameFilter(const QString &f)
{
QMutexLocker (&m_data->mutex);
QMutexLocker locker(&m_data->mutex);
m_data->selectedNameFilter = f;
}
@ -771,13 +771,13 @@ inline QString QWindowsFileDialogSharedData::selectedFile() const
inline void QWindowsFileDialogSharedData::setSelectedFiles(const QList<QUrl> &urls)
{
QMutexLocker (&m_data->mutex);
QMutexLocker locker(&m_data->mutex);
m_data->selectedFiles = urls;
}
inline void QWindowsFileDialogSharedData::fromOptions(const QSharedPointer<QFileDialogOptions> &o)
{
QMutexLocker (&m_data->mutex);
QMutexLocker locker(&m_data->mutex);
m_data->directory = o->initialDirectory();
m_data->selectedFiles = o->initiallySelectedFiles();
m_data->selectedNameFilter = o->initiallySelectedNameFilter();