Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / declarative / qml / qdeclarativeworkerscript.cpp
index 4e2bcdd..b17c026 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the QtDeclarative module of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
@@ -478,6 +478,10 @@ QDeclarativeWorkerScriptEngine::~QDeclarativeWorkerScriptEngine()
     QCoreApplication::postEvent(d, new QEvent((QEvent::Type)QDeclarativeWorkerScriptEnginePrivate::WorkerDestroyEvent));
     d->m_lock.unlock();
 
+    //We have to force to cleanup the main thread's event queue here
+    //to make sure the main GUI release all pending locks/wait conditions which
+    //some worker script/agent are waiting for (QDeclarativeListModelWorkerAgent::sync() for example).
+    QCoreApplication::processEvents();
     wait();
     d->deleteLater();
 }
@@ -526,9 +530,6 @@ void QDeclarativeWorkerScriptEngine::run()
 {
     d->m_lock.lock();
 
-    v8::Isolate *isolate = v8::Isolate::New(); 
-    isolate->Enter();
-
     d->workerEngine = new QDeclarativeWorkerScriptEnginePrivate::WorkerEngine(d);
     d->workerEngine->init();
 
@@ -542,9 +543,6 @@ void QDeclarativeWorkerScriptEngine::run()
     d->workers.clear();
 
     delete d->workerEngine; d->workerEngine = 0;
-    QV8GCCallback::releaseWorkerThreadGcPrologueCallbackData();
-    isolate->Exit();
-    isolate->Dispose();
 }