Merge pull request #15094 from pandamicro/v3

Fix lua engine crashes caused by CC_ENABLE_GC_FOR_NATIVE_OBJECTS
This commit is contained in:
pandamicro 2016-02-21 20:58:21 +08:00
commit 7607382440
1 changed files with 4 additions and 2 deletions

View File

@ -61,12 +61,13 @@ Ref::Ref()
Ref::~Ref()
{
#if CC_ENABLE_SCRIPT_BINDING && !CC_ENABLE_GC_FOR_NATIVE_OBJECTS
#if CC_ENABLE_SCRIPT_BINDING
// if the object is referenced by Lua engine, remove it
if (_luaID)
{
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptObjectByObject(this);
}
#if !CC_ENABLE_GC_FOR_NATIVE_OBJECTS
else
{
ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine();
@ -75,7 +76,8 @@ Ref::~Ref()
pEngine->removeScriptObjectByObject(this);
}
}
#endif
#endif // !CC_ENABLE_GC_FOR_NATIVE_OBJECTS
#endif // CC_ENABLE_SCRIPT_BINDING
#if CC_REF_LEAK_DETECTION