dynamic_cast in CCScheduler produces crash

dynamic_cast in CCScheduler produces crash
0.0 0


In the Test demo for the Scheduler I’ve changed the following for the class SchedulerUpdateAndCustom:

class SchedulerUpdateAndCustom : public SchedulerTestLayer, public BLCCButtonDelegate
{ … }

class BLCCButtonDelegate : public CCObject
virtual void alertBLCCButton() = 0;

void SchedulerUpdateAndCustom::alertBLCCButton() {}

Now when I run the scheduler demo it crashes when scheduleUpdate() is called.
Because the dynamic_cast returns null in the method CCScheduler::appendIn(_listEntry *ppList, SelectorProtocolpTarget, bool bPaused).

After some research it seems this problem is due to the diamond structure of the inheritance.


You are right, I think delegate class is something like interface, it should not inherit from CCObject.:slight_smile: