Fix another memory leak.
authorErik Verbruggen <erik.verbruggen@digia.com>
Tue, 4 Dec 2012 10:30:26 +0000 (11:30 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 4 Dec 2012 15:58:26 +0000 (16:58 +0100)
Now we should only leak objects that are VM::Values, and directly
related objects like the PropertyTable. The directly related ones will
disappear through destructor calls when the VM::Values are GC-ed.

Change-Id: Id221ac62a22671d86bbc6ac9beea49d2bd5b330d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qmljs_engine.cpp
qmljs_engine.h

index 6c5edd1..4af9005 100644 (file)
@@ -187,6 +187,13 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
     glo->__put__(rootContext, identifier(QStringLiteral("isFinite")), Value::fromObject(new IsFiniteFunction(rootContext))); // isFinite [15.1.2.5]
 }
 
+ExecutionEngine::~ExecutionEngine()
+{
+    delete globalObject.asObject();
+    delete rootContext;
+    delete stringPool; // the String pointers should get GC-ed.
+}
+
 ExecutionContext *ExecutionEngine::newContext()
 {
     return new ExecutionContext();
index a6f1808..d47c2d4 100644 (file)
@@ -150,6 +150,7 @@ struct ExecutionEngine
     struct StringPool *stringPool;
 
     ExecutionEngine(EvalISelFactory *iselFactory);
+    ~ExecutionEngine();
 
     ExecutionContext *newContext();