summaryrefslogtreecommitdiff
path: root/src/declarative/qml/qdeclarativeworkerscript.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2011-06-07 16:34:04 +1000
committerAaron Kennedy <aaron.kennedy@nokia.com>2011-06-07 17:00:11 +1000
commit53085399f56714db27cbdebe554146528d13c94e (patch)
tree3706a9938f7c2c2dbc13d77c07ffdc4c81b4185e /src/declarative/qml/qdeclarativeworkerscript.cpp
parent1c3dd8f22da09bf9a110715d159374a09c27dc77 (diff)
downloadqtdeclarative-53085399f56714db27cbdebe554146528d13c94e.tar.gz
Dispose of WorkerScripts in correct Isolate
We were disposing them in the main thread isolate which caused corruption of the v8 heap. Specifically this showed in asserting allocations of persistent handles.
Diffstat (limited to 'src/declarative/qml/qdeclarativeworkerscript.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index ad3ca58c6c..fd2b924f65 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -477,8 +477,6 @@ QDeclarativeWorkerScriptEngine::QDeclarativeWorkerScriptEngine(QDeclarativeEngin
QDeclarativeWorkerScriptEngine::~QDeclarativeWorkerScriptEngine()
{
d->m_lock.lock();
- qDeleteAll(d->workers);
- d->workers.clear();
QCoreApplication::postEvent(d, new QEvent((QEvent::Type)QDeclarativeWorkerScriptEnginePrivate::WorkerDestroyEvent));
d->m_lock.unlock();
@@ -530,7 +528,7 @@ void QDeclarativeWorkerScriptEngine::run()
{
d->m_lock.lock();
- v8::Isolate *isolate = v8::Isolate::New();
+ v8::Isolate *isolate = v8::Isolate::New();
isolate->Enter();
d->workerEngine = new QDeclarativeWorkerScriptEnginePrivate::WorkerEngine(d);
@@ -542,6 +540,9 @@ void QDeclarativeWorkerScriptEngine::run()
exec();
+ qDeleteAll(d->workers);
+ d->workers.clear();
+
delete d->workerEngine; d->workerEngine = 0;
isolate->Exit();