From 1d59a36ee97f790224ae21749aed61d591fb8009 Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 7 Jan 2013 17:34:22 +0800 Subject: [PATCH] fixed #1620: Invoking localStorageFree in the destructor of ScriptingCore. Added header file to cocos-ext.h --- extensions/cocos-ext.h | 20 ++++++++++--------- .../javascript/bindings/ScriptingCore.cpp | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/extensions/cocos-ext.h b/extensions/cocos-ext.h index 3a5e92d30e..bb0de6ce1c 100644 --- a/extensions/cocos-ext.h +++ b/extensions/cocos-ext.h @@ -41,16 +41,18 @@ #include "network/HttpResponse.h" #include "network/HttpClient.h" -// Physics integration -#if CC_ENABLE_CHIPMUNK_INTEGRATION -#include "physics_nodes/CCPhysicsDebugNode.h" -#include "physics_nodes/CCPhysicsSprite.h" -#endif - -#if CC_ENABLE_BOX2D_INTEGRATION -#include "physics_nodes/CCPhysicsDebugNode.h" -#include "physics_nodes/CCPhysicsSprite.h" +// Physics integration +#if CC_ENABLE_CHIPMUNK_INTEGRATION +#include "physics_nodes/CCPhysicsDebugNode.h" +#include "physics_nodes/CCPhysicsSprite.h" #endif +#if CC_ENABLE_BOX2D_INTEGRATION +#include "physics_nodes/CCPhysicsDebugNode.h" +#include "physics_nodes/CCPhysicsSprite.h" +#endif + +#include "LocalStorage/LocalStorage.h" + #endif /* __COCOS2D_EXT_H__ */ diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index 488e00d510..7b55ba7112 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -16,6 +16,7 @@ #include "ScriptingCore.h" #include "jsdbgapi.h" #include "cocos2d.h" +#include "cocos-ext.h" #include "cocos2d_specifics.hpp" // for debug socket #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) @@ -465,6 +466,7 @@ JSBool ScriptingCore::runScript(const char *path, JSObject* global, JSContext* c ScriptingCore::~ScriptingCore() { + localStorageFree(); removeAllRoots(cx_); JS_DestroyContext(cx_); JS_DestroyRuntime(rt_);