Reproducing 72056 "Hard crash when adding row to popup menu with AddRowAt where the index is too high"

The exception I’m getting is really different; even the crash type isn’t the same (EXC_BREAKPOINT (SIGTRAP) for me and EXC_BAD_INSTRUCTION (SIGILL) for you, rather odd):

Translated Report (Full Report Below)

Process: test.debug [32053]
Path: /Users/USER/Downloads/test.debug.app/Contents/MacOS/test.debug
Identifier: test.debug
Version: ???
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501

Date/Time: 2023-03-15 17:48:19.6593 +0100
OS Version: macOS 13.2.1 (22D68)
Report Version: 12
Anonymous UUID: E9223FE8-AFD9-1127-2C5E-B25AFC7CAB54

Sleep/Wake UUID: 1B047CDB-DF6C-4D7A-A166-92F6CF992459

Time Awake Since Boot: 47000 seconds
Time Since Wake: 679 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001aeea07dc

Termination Reason: Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process: exc handler [32053]

Application Specific Backtrace 0:
0 CoreFoundation 0x00000001ab9b43e8 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x00000001ab4feea8 objc_exception_throw + 60
2 Foundation 0x00000001ac8f7910 -[NSCalendarDate initWithCoder:] + 0
3 AppKit 0x00000001aebb3554 -[NSMenu insertItem:atIndex:] + 608
4 XojoFramework 0x00000001013f1270 _ZN14CocoaPopupMenu10InsertItemEi6stringPv + 176
5 XojoFramework 0x0000000101556814 RuntimeComboBoxInsertRow + 108
6 test.debug 0x000000010051bfd8 DesktopPopupMenu.AddRowAt%%oi8s + 64
7 test.debug 0x00000001005c4380 Window1.Window1.PopupMenu1_Opening%%o<Window1.Window1>o + 508
8 test.debug 0x00000001005c6bc0 Delegate.IM_Invoke%%o + 60
9 test.debug 0x00000001005c6c0c AddHandler.Stub.2%% + 56
10 XojoFramework 0x00000001015bc498 FireWindowOpenEvents + 276
11 test.debug 0x00000001005311d0 DesktopWindow.Constructor%%o + 68
12 test.debug 0x00000001005c69a8 Window1.Window1%o<Window1.Window1>% + 500
13 test.debug 0x00000001005cc3f8 _MakeDefaultView + 112
14 test.debug 0x00000001005cc6b8 _LateStartup + 84
15 XojoFramework 0x000000010141bf8c _Z29CocoaFinishApplicationStartupv + 236
16 XojoFramework 0x000000010141aa8c _Z27PluginGetCocoaViewCallbacksv + 1320
17 CoreFoundation 0x00000001ab92e560 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 148
18 CoreFoundation 0x00000001ab9cc044 ___CFXRegistrationPost_block_invoke + 88
19 CoreFoundation 0x00000001ab9cbf8c _CFXRegistrationPost + 440
20 CoreFoundation 0x00000001ab8ffb64 _CFXNotificationPost + 708
21 Foundation 0x00000001ac7ef38c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
22 AppKit 0x00000001aebc4c38 -[NSApplication _postDidFinishNotification] + 284
23 AppKit 0x00000001aebc49e8 -[NSApplication _sendFinishLaunchingNotification] + 172
24 AppKit 0x00000001aebbdbf0 _DPSNextEvent + 1564
25 AppKit 0x00000001aebbc9dc -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728
26 XojoFramework 0x000000010141c878 _Z29CocoaFinishApplicationStartupv + 2520
27 XojoFramework 0x000000010141c900 _Z29CocoaFinishApplicationStartupv + 2656
28 test.debug 0x00000001004febf4 DesktopApplication._CallFunctionWithExceptionHandling%%op + 164
29 XojoFramework 0x00000001015a6e9c _Z33CallFunctionWithExceptionHandlingPFvvE + 180
30 XojoFramework 0x000000010141c89c _Z29CocoaFinishApplicationStartupv + 2556
31 AppKit 0x00000001aebb0e0c -[NSApplication run] + 464
32 XojoFramework 0x00000001015a56f8 RuntimeRun + 48
33 test.debug 0x000000010053e020 REALbasic._RuntimeRun + 28
34 test.debug 0x00000001005cc9f0 _Main + 712
35 test.debug 0x00000001005cbe20 main + 36
36 dyld 0x00000001ab52fe50 start + 2544

Kernel Triage:
VM - pmap_enter retried due to resource shortage

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 AppKit 0x1aeea07dc -[NSApplication _crashOnException:] + 240
1 AppKit 0x1aeea07d4 -[NSApplication _crashOnException:] + 232
2 AppKit 0x1aeea05b8 -[NSApplication reportException:] + 440
3 AppKit 0x1aebb0ebc -[NSApplication run] + 640
4 XojoFramework 0x1015a56f8 RuntimeRun + 48
5 test.debug 0x10053e020 REALbasic._RuntimeRun + 28
6 test.debug 0x1005cc9f0 _Main + 712 (/#main:109)
7 test.debug 0x1005cbe20 main + 36
8 dyld 0x1ab52fe50 start + 2544

Probably you both are using different Xojo versions / macOS versions.

Doesn’t look to be the case. The only visible difference (OS and Xojo) is the OS language.

This is sounding like it may be two separate but related bugs?

As I said, I’ve seen kind of same bugs ending differently depending on Xojo versions and/or OS versions. Sometimes a null pointer, sometimes a pointer to a invalid data or sometimes a pointer to a invalid call.

Recently William was working on bugs causing SIGTRAPs if I do recall correctly. So, some versions includes it (those bugs), some recent ones may not. But not firing the SIGTRAP could lead to SIGILL.

Way back when, @Greg_O shared how to enable it System wide.

I’m incredibly surprised that the current Xojo engineers don’t know about this, especially as they need it to diagnose bugs in the Xojo framework.

1 Like

And, as I said too, we’re both using the same Xojo and OS version.

Yes, for the test project I had used the generic bundle identifier. The main app uses NSApplicationCrashOnExceptions set to true. But I never do this for test apps.

I can assure you that SOMETHING differs on both tests, Universal code emitter, M1 code only emitter, the “last beta” not being the same “beta”, NSUserDefaults differences, etc. You can’t deny that. What was the specific difference, where one code fires a trap (a machine code breakpoint probably preceding an exception crash) and another reaching the exception directly, could be researched, but it would be a silly and unnecessary effort as the point of failure is the same, and once fixed, both variants will disappear.

I don’t deny that, I agree.

:+1:t2: