Skip to content

calling static method crashes 2.1.3 cocos2dx framwork #2905

@ghost

Description

Hi

I just tried to switch from 2.1.2 code line to the 2.1.3 codeline and found the following issue. Calling a static method from a static method causes a "exc_bad_instruction" in xcode

if you add the folloing test class below to any project and call the static method runall from the appdelegate it will crash!
Header:

class Test
{
public:
    Test();
    static bool runAllTests();
    static int test1();
};

C++:

Test::runAllTests(){
    int testErrorCount = 0;
    testErrorCount = Test::test1();
    Test *tLE = new Test();
    //    tLE->mLayer = layer;
    return true;
}
Test::Test(){

}

int Test::test1(){
    CCFileUtils* fileUtil;
    string filename = fileUtil->getWritablePath();
    filename.append("test.txt");
    int error = remove((char*)filename.c_str());
    return error;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions