我有继承Layer类的GameModeSimple类。这是我写入该类的内容:
void GameModeSimple::scheduleBreaks()
{
float dt = getBreakGenerateDeltaTime();
layer->schedule(schedule_selector(GameModeSimple::generateBreaks), 3);
}
void GameModeSimple::generateBreaks(float dt)
{
repetitionCount--;
CCLOG("Name is %i", layer->getTag());
}
进入" generateBreaks"功能,当删除" CCLOG"它可以工作,但是当写崩溃时。这是堆栈跟踪:
********** Crash dump: **********
Build fingerprint: 'samsung/delos3gxx/delos3geur:4.1.2/JZO54K/I8552XXAMK2:user/r
elease-keys'
pid: 7737, tid: 7761, name: Thread-23546 >>> com.game.breaker <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame I/DEBUG ( 4687): #00 pc 00162ebe /data/data/com.game.breaker
/lib/libcocos2dcpp.so (GameModeSimple::generateBreaks(float)+17): Routine GameMo
deSimple::generateBreaks(float) at D:\GameFile\COCOS\breaker\proj.android/jni/..
/../Classes/GameModeSimple.cpp:29
Stack frame I/DEBUG ( 4687): #01 pc 003f0fbc /data/data/com.game.breaker
/lib/libcocos2dcpp.so (cocos2d::TimerTargetSelector::trigger()+208): Routine coc
os2d::TimerTargetSelector::trigger() at D:\GameFile\COCOS\breaker\proj.android/j
ni/../../cocos2d/cocos/./base/CCScheduler.cpp:170