From: Erik Verbruggen Date: Tue, 4 Dec 2012 10:30:26 +0000 (+0100) Subject: Fix another memory leak. X-Git-Tag: upstream/5.2.1~669^2~659^2~758 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=070e0d07d821342bfbe7a409a51c4c53185c62c7;p=platform%2Fupstream%2Fqtdeclarative.git Fix another memory leak. 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 --- diff --git a/qmljs_engine.cpp b/qmljs_engine.cpp index 6c5edd1..4af9005 100644 --- a/qmljs_engine.cpp +++ b/qmljs_engine.cpp @@ -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(); diff --git a/qmljs_engine.h b/qmljs_engine.h index a6f1808..d47c2d4 100644 --- a/qmljs_engine.h +++ b/qmljs_engine.h @@ -150,6 +150,7 @@ struct ExecutionEngine struct StringPool *stringPool; ExecutionEngine(EvalISelFactory *iselFactory); + ~ExecutionEngine(); ExecutionContext *newContext();