glview->pollEvents(); randon crash mac on cocos2d-x 3.15.1

glview->pollEvents(); randon crash mac on cocos2d-x 3.15.1
0.0 0

#1

Hi,

I am updating a mac game from cocos2d-x 2.2.6 to cocos2d-x 3.15.1, the code update is done but I get a random crash con glview->pollEvents(); What can I do? I am using XCode 8.3.3 and Mac OS 10.12.15. Here is the backtrace from xcode:

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00007fffb722315f libsystem_malloc.dylib`malloc_error_break
    frame #1: 0x00007fffb7224d21 libsystem_malloc.dylib`nanozone_error + 406
    frame #2: 0x00007fffb721a588 libsystem_malloc.dylib`_nano_malloc_check_clear + 427
    frame #3: 0x00007fffb721aa77 libsystem_malloc.dylib`nano_calloc + 70
    frame #4: 0x00007fffb721543e libsystem_malloc.dylib`malloc_zone_calloc + 87
    frame #5: 0x00007fffb7215d7f libsystem_malloc.dylib`calloc + 30
    frame #6: 0x000000010096ff8e libdispatch.dylib`_dispatch_continuation_alloc_from_heap + 49
    frame #7: 0x00000001009866ad libdispatch.dylib`_dispatch_root_queue_push_override + 337
    frame #8: 0x00007fffa754e1c7 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 2447
    frame #9: 0x00007fffa7442881 QuartzCore`CA::Transaction::commit() + 475
  * frame #10: 0x00007fffa744329c QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 108
    frame #11: 0x00007fffa1936d37 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    frame #12: 0x00007fffa1936ca7 CoreFoundation`__CFRunLoopDoObservers + 391
    frame #13: 0x00007fffa1917136 CoreFoundation`CFRunLoopRunSpecific + 454
    frame #14: 0x00007fffa0e78ebc HIToolbox`RunCurrentEventLoopInMode + 240
    frame #15: 0x00007fffa0e78bf9 HIToolbox`ReceiveNextEventCommon + 184
    frame #16: 0x00007fffa0e78b26 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
    frame #17: 0x00007fff9f411a54 AppKit`_DPSNextEvent + 1120
    frame #18: 0x00007fff9fb8d7ee AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2796
    frame #19: 0x00000001001d80aa Think'N'Link`_glfwPlatformPollEvents + 154
    frame #20: 0x00000001001ad57a Think'N'Link`cocos2d::Application::run(this=0x00007fff5fbff628) at CCApplication-mac.mm:90 [opt]
    frame #21: 0x0000000100012ef5 Think'N'Link`main(argc=<unavailable>, argv=<unavailable>) at main.cpp:33 [opt]
    frame #22: 0x00007fffb7091235 libdyld.dylib`start + 1

#2

HI again,

After days of debugging I could see that this line:

PoolManager::getInstance()->getCurrentPool()->clear();

from method void Director::mainLoop() was throwing the crash, commenting out this line and the crash goes away.

Thanks


#3

Thanks for your feedback, but the crash stack seems not to be caused by PoolManager::getInstance()->getCurrentPool()->clear();.
I have no idea about how it crashed. Any reproduced demo could you provide?