diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-07-08 12:19:29 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2009-07-08 14:48:20 (GMT) |
commit | 09303c005c1a41e0fb6bbf8375cdd72d46346a34 (patch) | |
tree | 69562bd202c92dd1730096d37564aa2b396922b2 /src/script/api/qscriptengine.cpp | |
parent | c4c23b83d9ce6635b06fb570c30500c5da014111 (diff) | |
download | Qt-09303c005c1a41e0fb6bbf8375cdd72d46346a34.zip Qt-09303c005c1a41e0fb6bbf8375cdd72d46346a34.tar.gz Qt-09303c005c1a41e0fb6bbf8375cdd72d46346a34.tar.bz2 |
Fix engineDelete autotest.
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 3d72990..122c3e5 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -20,6 +20,7 @@ #include "qscriptvalue_p.h" #include "qscriptvalueiterator.h" #include "qscriptclass.h" +#include "qdebug.h" #include <QtCore/qstringlist.h> #include <QtCore/qmetaobject.h> @@ -868,6 +869,7 @@ QScriptEnginePrivate::QScriptEnginePrivate() QScriptEnginePrivate::~QScriptEnginePrivate() { + detachAllRegisteredScriptValues(); qDeleteAll(m_qobjectData); qDeleteAll(m_typeInfos); } @@ -1198,6 +1200,18 @@ bool QScriptEnginePrivate::scriptDisconnect(JSC::JSValue signal, JSC::JSValue re #endif +void QScriptEnginePrivate::detachAllRegisteredScriptValues() +{ + //make copy of attachedScriptValues (orignal set will be modified) + QSet<QScriptValuePrivate*> tmpSet(attachedScriptValues); + QSet<QScriptValuePrivate*>::const_iterator i = tmpSet.begin(); + while (i != tmpSet.end()) { + //this will autmagicly remove *i from attachedScriptValues + (*i)->detachEngine(); + i++; + } +} + QScriptEnginePrivate *QScriptEnginePrivate::get(QScriptEngine *q) { if (!q) |