mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Merge pull request #703 from pandamicro/develop
Fix simulator crash during app close
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -43,12 +43,16 @@ JS::Value JavaScriptObjCBridge::convertReturnValue(JSContext *cx, ReturnValue re
|
||||
{
|
||||
case TypeInteger:
|
||||
ret = JS::Int32Value(retValue.intValue);
|
||||
break;
|
||||
case TypeFloat:
|
||||
ret = JS::DoubleValue((double)retValue.floatValue);
|
||||
break;
|
||||
case TypeBoolean:
|
||||
ret = JS::BooleanValue(retValue.boolValue);
|
||||
break;
|
||||
case TypeString:
|
||||
c_string_to_jsval(cx, retValue.stringValue->c_str(), &ret, retValue.stringValue->size());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user