Happens on workspace reload, i.e.:
ParseManager::OnParserStart: Starting batch parsing for project 'Code statistics wx3.2.x (macOS)'...
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: MacRoman (ID: 49)
Conversion succeeded using wxEncodingConverter (buffer size = 11699, converted size = 11703.
Editor Open
Start switch from OnEditorActivatedTimer
Switch parser to project 'Code statistics wx3.2.x (macOS)'
Process 82365 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (codeblocks) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000000000000
    frame #1: 0x0000000101bf3498 libwx_osx_cocoau_core-3.2.0.dylib`wxTimerImpl::Notify(this=0x000060000187b300) at timer.h:47:38
    frame #2: 0x0000000101bf2e54 libwx_osx_cocoau_core-3.2.0.dylib`wxProcessTimer((null)=0x0000600002d2a940, data=0x000060000187b300) at timer.cpp:38:12
    frame #3: 0x000000018858fc50 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
    frame #4: 0x000000018858f910 CoreFoundation`__CFRunLoopDoTimer + 980
    frame #5: 0x000000018858f44c CoreFoundation`__CFRunLoopDoTimers + 332
    frame #6: 0x0000000188575858 CoreFoundation`__CFRunLoopRun + 1848
    frame #7: 0x0000000188574a98 CoreFoundation`CFRunLoopRunSpecific + 572
    frame #8: 0x000000019401727c HIToolbox`RunCurrentEventLoopInMode + 324
    frame #9: 0x000000019401a4e8 HIToolbox`ReceiveNextEventCommon + 676
    frame #10: 0x00000001941a5484 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
    frame #11: 0x000000018c499a34 AppKit`_DPSNextEvent + 684
    frame #12: 0x000000018ce38940 AppKit`-[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
    frame #13: 0x000000018c48cbe4 AppKit`-[NSApplication run] + 480
    frame #14: 0x0000000101ca8478 libwx_osx_cocoau_core-3.2.0.dylib`wxGUIEventLoop::OSXDoRun(this=0x0000600003d28000) at evtloop.mm:301:13
    frame #15: 0x00000001011604b0 libwx_baseu-3.2.0.dylib`wxCFEventLoop::DoRun(this=0x0000600003d28000) at evtloop_cf.cpp:326:13
    frame #16: 0x0000000101072824 libwx_baseu-3.2.0.dylib`wxEventLoopBase::Run(this=0x0000600003d28000) at evtloopcmn.cpp:87:12
    frame #17: 0x0000000101025400 libwx_baseu-3.2.0.dylib`wxAppConsoleBase::MainLoop(this=0x000000011d040400) at appbase.cpp:395:37
    frame #18: 0x0000000101024f10 libwx_baseu-3.2.0.dylib`wxAppConsoleBase::OnRun(this=0x000000011d040400) at appbase.cpp:317:12
    frame #19: 0x00000001018c8160 libwx_osx_cocoau_core-3.2.0.dylib`wxAppBase::OnRun(this=0x000000011d040400) at appcmn.cpp:334:26
    frame #20: 0x0000000101c236dc libwx_osx_cocoau_core-3.2.0.dylib`wxApp::OnRun(this=0x000000011d040400) at app.cpp:364:23
    frame #21: 0x0000000100008414 codeblocks`___lldb_unnamed_symbol4070 + 40
    frame #22: 0x00000001010b1638 libwx_baseu-3.2.0.dylib`wxEntry(argc=0x000000010125265c, argv=0x000060000151d360) at init.cpp:497:26
    frame #23: 0x00000001010b17f8 libwx_baseu-3.2.0.dylib`wxEntry(argc=0x000000016fdfee28, argv=0x000000016fdff4a8) at init.cpp:509:12
    frame #24: 0x0000000100000be0 codeblocks`___lldb_unnamed_symbol4012 + 40
    frame #25: 0x00000001880eab98 dyld`start + 6076
On macOS, it seems CFRunLoop can fire timer callbacks after wxTimer::Stop() has been called. wxTimerImpl::Notify() tries to dispatch event to disconnected handler but it jumps to a null function pointer → crash (frame #0: 0x0000000000000000).
The fix introduces a wxSafeTimer wrapper (macOS only) that validates the parent CodeCompletion
object is still valid and initialized before dispatching timer events, preventing the crash.
I don't see issues with the timer firing logic. So, this may be also a candidate fix for the wxWidgets library. 
Applied patch (adapted to code style) in [r13744], thank you.
Related
Commit: [r13744]
Thank you!
PS: I believe
ccTimerneeds renaming also above in the classtypedefs:Last edit: Federico Perini 2025-10-08