Fix simulator crash during app close

This commit is contained in:
pandamicro
2017-07-10 18:30:55 +08:00
parent 144c49a6d7
commit d32214f0d2
2 changed files with 7 additions and 0 deletions
@@ -1914,7 +1914,12 @@ bool jsb_remove_proxy(js_proxy_t* proxy)
bool jsb_unbind_proxy(js_proxy_t* proxy)
{
void* nativeKey = proxy->ptr;
#if COCOS2D_DEBUG > 1
CC_ASSERT(nativeKey && "Invalid nativeKey");
#else
if (!nativeKey)
return false;
#endif // COCOS2D_DEBUG
// delete entry in native proxy map
auto it_nat = _native_js_global_map.find(nativeKey);
@@ -76,7 +76,9 @@ namespace jsb
}
~Object()
{
#if COCOS2D_DEBUG > 1
CCLOG("Release JSBObject %p, with proxy: %p", this, _proxy);
#endif // COCOS2D_DEBUG
if (_proxy)
{
jsb_remove_proxy(_proxy);