Fix usage of QMutexLocker
authorKai Koehne <kai.koehne@nokia.com>
Tue, 24 Apr 2012 13:17:24 +0000 (15:17 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 24 Apr 2012 13:58:25 +0000 (15:58 +0200)
Not giving QMutexLocker a name means that it's lifetime is
not guaranteed to be bound to the current scope.

Change-Id: I6e58b0aab814c5e686fac3ff0aa6b671e17db240
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
src/qml/qml/qquickworkerscript.cpp

index e689f9d..b00847a 100644 (file)
@@ -282,7 +282,7 @@ v8::Handle<v8::Value> QQuickWorkerScriptEnginePrivate::sendMessage(const v8::Arg
 
     QByteArray data = QV8Worker::serialize(args[2], engine);
 
-    QMutexLocker(&engine->p->m_lock);
+    QMutexLocker locker(&engine->p->m_lock);
     WorkerScript *script = engine->p->workers.value(id);
     if (!script)
         return v8::Undefined();
@@ -405,7 +405,7 @@ void QQuickWorkerScriptEnginePrivate::reportScriptException(WorkerScript *script
 {
     QQuickWorkerScriptEnginePrivate *p = QQuickWorkerScriptEnginePrivate::get(workerEngine);
 
-    QMutexLocker(&p->m_lock);
+    QMutexLocker locker(&p->m_lock);
     if (script->owner)
         QCoreApplication::postEvent(script->owner, new WorkerErrorEvent(error));
 }