I’m struggling to pin down an intermittent hard crash of the app I’m developing and I wonder if anyone can help me?
I’m working on a code editor and the crash happens when I paste a large volume of text into the editor. It only happens occasionally and sometimes the pasted text causes the crashes but then pasting the same text again doesn’t cause the crash.
I have attached the macOS crash log below and I’m wondering if this is a bug in my NextToken method or if it’s a problem with the Xojo framework since it seems to say:
pointer being freed was not allocated
Any thoughts how to debug this further?
Process: Better Code Editor Dev Harness.debug [21181]
Path: /Users/USER/*/Better Code Editor Dev Harness.debug.app/Contents/MacOS/Better Code Editor Dev Harness.debug
Identifier: com.garrypettet.better-code-editor-dev-harness
Version: ??? (1.0.0.0.0)
Code Type: ARM-64 (Native)
Parent Process: ??? [1]
Responsible: Better Code Editor Dev Harness.debug [21181]
User ID: 501
Date/Time: 2021-08-15 07:54:20.063 +0100
OS Version: macOS 11.5.1 (20G80)
Report Version: 12
Anonymous UUID: 2C3CE5B0-9614-8108-10F6-FD4A0A634A14
Sleep/Wake UUID: 9E05AB15-E0F8-4B5A-9BF1-66C3EFA0020B
Time Awake Since Boot: 43000 seconds
Time Since Wake: 730 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
Performing @selector(menuItemAction:) from sender NSMenuItem 0x6000002f5490
abort() called
Better Code Editor Dev Harness.debug(21181,0x104a9bd40) malloc: *** error for object 0x12c70e697: pointer being freed was not allocated
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x0000000199714e68 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000019974743c pthread_kill + 292
2 libsystem_c.dylib 0x000000019968f454 abort + 124
3 libsystem_malloc.dylib 0x0000000199577ecc malloc_vreport + 560
4 libsystem_malloc.dylib 0x000000019957b514 malloc_report + 64
5 libsystem_malloc.dylib 0x000000019956a5cc free + 516
6 com.xojo.XojoFramework 0x0000000104cf1cbc RuntimeUnlockObject + 904
7 com.garrypettet.better-code-editor-dev-harness 0x000000010437f358 DartFormatter.NextToken%%o<DartFormatter> + 15840 (/DartFormatter:301)
8 com.garrypettet.better-code-editor-dev-harness 0x000000010437925c DartFormatter.TokeniseLine%%o<DartFormatter>o<BCELine> + 220 (/DartFormatter:67)
9 com.garrypettet.better-code-editor-dev-harness 0x000000010441ec00 BCELine.Tokenise%%o<BCELine> + 2040 (/BCELine:807)
10 com.garrypettet.better-code-editor-dev-harness 0x000000010440e468 BCELine.=Contents%%o<BCELine>bby + 604 (/BCELine:98)
11 com.garrypettet.better-code-editor-dev-harness 0x000000010440df64 BCELine.Constructor%%o<BCELine>o<BCELineManager>i8i8i8y + 844 (/BCELine:67)
12 com.garrypettet.better-code-editor-dev-harness 0x0000000104448e74 BCELineManager.InsertText%%o<BCELineManager>i8ybb + 24956 (/BCELineManager:649)
13 com.garrypettet.better-code-editor-dev-harness 0x00000001043e28e0 BCECanvas.Insert%%o<BCECanvas>yi8b + 1452 (/BCECanvas:1345)
14 com.garrypettet.better-code-editor-dev-harness 0x0000000104347e18 WinEditor.WinEditor._EditPaste_Action%b%o<WinEditor.WinEditor> + 2244 (/WinEditor:199)
15 com.xojo.XojoFramework 0x0000000104c50024 InvokeMenuHandler(RunMenuItem*, unsigned char, Window*, unsigned char&) + 1008
16 com.xojo.XojoFramework 0x0000000104c50300 RuntimeMenuItemClick(RunMenuItem*, unsigned char, Window*, unsigned char*) + 116
17 com.xojo.XojoFramework 0x0000000104b58068 CocoaMenu::_MenuItemAction(NSMenuItem*) + 76
18 com.xojo.XojoFramework 0x0000000104b586f0 0x104ae8000 + 460528
19 com.apple.AppKit 0x000000019c24e460 -[NSApplication(NSResponder) sendAction:to:from:] + 456
20 com.apple.AppKit 0x000000019c34d764 -[NSMenuItem _corePerformAction] + 444
21 com.apple.AppKit 0x000000019c34d454 -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 100
22 com.apple.AppKit 0x000000019c34c410 -[NSMenu performKeyEquivalent:] + 412
23 com.apple.AppKit 0x000000019c7ad868 routeKeyEquivalent + 444
24 com.apple.AppKit 0x000000019c1b64b8 -[NSApplication(NSEvent) sendEvent:] + 1176
25 com.xojo.XojoFramework 0x0000000104b76b64 0x104ae8000 + 584548
26 com.garrypettet.better-code-editor-dev-harness 0x000000010427a990 Application._CallFunctionWithExceptionHandling%%o<Application>p + 164
27 com.xojo.XojoFramework 0x0000000104cef384 CallFunctionWithExceptionHandling(void (*)()) + 180
28 com.xojo.XojoFramework 0x0000000104b76b14 0x104ae8000 + 584468
29 com.apple.AppKit 0x000000019c483bac -[NSApplication _handleEvent:] + 76
30 com.apple.AppKit 0x000000019c0262b8 -[NSApplication run] + 636
31 com.xojo.XojoFramework 0x0000000104cedc64 RuntimeRun + 48
32 com.garrypettet.better-code-editor-dev-harness 0x00000001042ee82c REALbasic._RuntimeRun + 28
33 com.garrypettet.better-code-editor-dev-harness 0x000000010449694c _Main + 712 (/#main:107)
34 com.garrypettet.better-code-editor-dev-harness 0x0000000104495ba4 main + 36
35 libdyld.dylib 0x0000000199765430 start + 4
