Projects > cpp > Issues > Bug #3856

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Crash when Firefox connects to JSB application

Bug #3856 [Closed]
dumganhar 2014-01-26 05:53 . Updated almost 3 years ago

Fixed at https://github.com/cocos2d/cocos2d-x/pull/5227

It only could be reproduced on Mac platform.

Reproduce Step

  • Use release version of Spidermonkey for Mac.
  • Run TestJavascript or any other JSB projects
  • Launch Firefox v25(or higher version), connect to JSB application.

Then, crash at

1
2
3
4
5
6
7
8
9
10
void ScriptingCore::debugProcessInput(const std::string& str)
{
    JSAutoCompartment ac(_cx, _debugGlobal);

    JSString* jsstr = JS_NewStringCopyZ(_cx, str.c_str());
    jsval argv = STRING_TO_JSVAL(jsstr);
    jsval outval;

    JS_CallFunctionName(_cx, _debugGlobal, "processInput", 1, &argv, &outval);  // Crash here.
}

How to Fix

1
2
3
4
5
6
void ScriptingCore::enableDebugger()
{
 ...    
        _debugGlobal = NewGlobalObject(_cx, true);
        // Adds the debugger object to root, otherwise it may be collected by GC.
        JS_AddObjectRoot(_cx, &_debugGlobal);  // Added this line to add debug object to root.
dumganhar 2014-01-27 02:05
  • Description updated (diff)
  • Status changed from New to Closed

Atom PDF

Status:Closed
Start date:2014-01-26
Priority:Normal
Due date:
Assignee:dumganhar
% Done:

0%

Category:js
Target version:3.0-beta2

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.