I just updated a project to cocos2d-x 3.15, and noticed that AppDelegate.cpp now has the following code:
USE_AUDIO_ENGINE is defined, so it’s calling “AudioEngine::end();” in the AppDelegate destructor, but when it does so, it crashes.
AudioEngine::end() does this “delete _audioEngineImpl;”, then in “AudioEngineImpl::~AudioEngineImpl”, it does the following:
if (_scheduler != nullptr)
This is where the crash happens, in CCScheduler.cpp, function Scheduler::unschedule:
void Scheduler::unschedule(SEL_SCHEDULE selector, Ref *target)
// explicit handle nil arguments when removing an object
if (target == nullptr || selector == nullptr)
tHashTimerEntry *element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element); <= crashes right here, with "_hashForTimers" having an invalid value (such as 0xDDDDDDDD).
I have absolutely no idea why this is happening, and will look into it further, but just on a quick glance I don’t actually know what this section of code does, nor why _hashForTimers would contain an invalid value.
Before I log this in as an issue, has anyone else experienced this crash, or have an idea why it may be happening?
It is reproducible, and happens any time I close the game application.