summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-15 12:56:03 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-15 12:56:03 (GMT)
commit422e26fc3e51e936fc3c00c491b9b512e82236f5 (patch)
treef9a5bcc5ee9a30d588bed4c9cde7d30bc412fcf0 /src
parent3983c9f396ca642caec2387bfe76fa6a9ca233f3 (diff)
downloadQt-422e26fc3e51e936fc3c00c491b9b512e82236f5.zip
Qt-422e26fc3e51e936fc3c00c491b9b512e82236f5.tar.gz
Qt-422e26fc3e51e936fc3c00c491b9b512e82236f5.tar.bz2
fix some memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/script/api/qscriptengine.cpp8
-rw-r--r--src/script/api/qscriptengine_p.h1
-rw-r--r--src/script/bridge/qscriptqobject.cpp1
3 files changed, 8 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index c69f1ee..c88f464 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -811,8 +811,8 @@ QScriptEnginePrivate::QScriptEnginePrivate() : idGenerator(1)
JSC::initializeThreading(); // ### hmmm
- JSC::JSGlobalData *data = JSC::JSGlobalData::create().releaseRef();
- globalObject = new (data)QScript::GlobalObject(this);
+ globalData = JSC::JSGlobalData::create().releaseRef();
+ globalObject = new (globalData)QScript::GlobalObject(this);
JSC::ExecState* exec = globalObject->globalExec();
@@ -847,6 +847,10 @@ QScriptEnginePrivate::~QScriptEnginePrivate()
detachAllRegisteredScriptValues();
qDeleteAll(m_qobjectData);
qDeleteAll(m_typeInfos);
+ qDeleteAll(contextForFrameHash);
+ JSC::JSLock lock(false);
+ globalData->heap.destroy();
+ globalData->deref();
}
QScriptValue QScriptEnginePrivate::scriptValueFromJSCValue(JSC::JSValue value)
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 29581e4..1626428 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -156,6 +156,7 @@ public:
void _q_objectDestroyed(QObject *);
#endif
+ JSC::JSGlobalData *globalData;
JSC::JSGlobalObject *globalObject;
JSC::JSObject *customGlobalObject;
JSC::ExecState *currentFrame;
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 4a7cd1e..85e255c 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1582,6 +1582,7 @@ QMetaObjectWrapperObject::QMetaObjectWrapperObject(
QMetaObjectWrapperObject::~QMetaObjectWrapperObject()
{
+ delete data;
}
bool QMetaObjectWrapperObject::getOwnPropertySlot(