From dc899d978eaf0ad2afc2768ab8b731974b791966 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Fri, 17 Apr 2015 13:07:16 +0200 Subject: Better JSKit memory management Attach context objects as _engine children, so they get destroyed by parent when engine is deleted. --- daemon/jskitmanager.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'daemon/jskitmanager.cpp') diff --git a/daemon/jskitmanager.cpp b/daemon/jskitmanager.cpp index a5be709..2da1986 100644 --- a/daemon/jskitmanager.cpp +++ b/daemon/jskitmanager.cpp @@ -132,12 +132,12 @@ void JSKitManager::startJsApp() } _engine = new QJSEngine(this); - _jspebble = new JSKitPebble(_curApp, this); - _jsconsole = new JSKitConsole(this); - _jsstorage = new JSKitLocalStorage(_curApp.uuid(), this); - _jsgeo = new JSKitGeolocation(this); + _jspebble = new JSKitPebble(_curApp, this, _engine); + _jsconsole = new JSKitConsole(_engine); + _jsstorage = new JSKitLocalStorage(_curApp.uuid(), _engine); + _jsgeo = new JSKitGeolocation(this, _engine); - qCDebug(l) << "starting JS app"; + qCDebug(l) << "starting JS app" << _curApp.shortName(); QJSValue globalObj = _engine->globalObject(); @@ -196,10 +196,4 @@ void JSKitManager::stopJsApp() _engine->deleteLater(); _engine = 0; - _jsstorage->deleteLater(); - _jsstorage = 0; - _jsgeo->deleteLater(); - _jsgeo = 0; - _jspebble->deleteLater(); - _jspebble = 0; } -- cgit v1.2.3