I have a rather old CRM project that I have been updating since 2006. In this project I call a SearchCustomer Window with which I can search a customer in my database and send that info back to the main window from which it’s called. I do that by using a ShowModal in the SearchCustomer window that keeps the app waiting until it receives a customer back from SearchCustomer. This has worked for over 15 years up until now: our new Apple Silicon machines with Monterey keep throwing errors when you open the search window and before choosing a customer you switch back and forth to/from another application. If I don’t switch, just search a customer and select it and continue working in my app, the app resumes without error (so luckily the crash only happens occasionly).
I went through the code with a fine toothcomb and can only solve the error problem if I replace ShowModal with Show, but then the app doesn’t work properly anymore since the code keeps running without waiting for the search result.
Since I fear it’s a bug I can’t solve, because there’s nothing wrong with the code (it runs fine on Intel machines): is there another way to keep the app waiting for info like a ShowModal command does?
BTW: I use Xojo 2021 release 3.1
My crash log:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: Comos [11040]
Path: /Applications/Comos/Comos.app/Contents/MacOS/Comos
Identifier: com.Comatherm.Comos
Version: (6.1.0.3.86)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 502
Date/Time: 2022-02-03 09:29:23.2866 +0100
OS Version: macOS 12.1 (21C52)
Report Version: 12
Anonymous UUID: 74BBD9E1-1B83-F80B-A3F0-888F52446A88
Sleep/Wake UUID: DCA696E9-FCD9-49F5-BE91-1E4A1E897CE6
Time Awake Since Boot: 42000 seconds
Time Since Wake: 3740 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [11040]
VM Region Info: 0 is not in any region. Bytes before following region: 4305715200
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 100a40000-101c74000 [ 18.2M] r-x/r-x SM=COW ...s/MacOS/Comos
Application Specific Information:
Performing @selector(performClick:) from sender XOJButton 0x10e912370
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x18dfbd884 _platform_strlen + 4
1 libsystem_c.dylib 0x18de70548 __vfprintf + 4576
2 libsystem_c.dylib 0x18de6f1e4 __v2printf + 408
3 libsystem_c.dylib 0x18de9e150 _vasprintf + 224
4 HIToolbox 0x196e3956c HILogToClient + 44
5 HIToolbox 0x196e39988 HIPrintBacktrace + 44
6 HIToolbox 0x196c7a440 MenuBarInstance::EnsureAutoShowObserver() + 120
7 HIToolbox 0x196c1c144 SetMenuBarObscured + 220
8 HIToolbox 0x196c1bdb4 HIApplication::HandleActivated(OpaqueEventRef*, unsigned char, OpaqueWindowPtr*, unsigned char) + 172
9 HIToolbox 0x196c15e68 HIApplication::EventObserver(unsigned int, OpaqueEventRef*, void*) + 296
10 HIToolbox 0x196bdcc0c _NotifyEventLoopObservers + 172
11 HIToolbox 0x196c1585c AcquireEventFromQueue + 508
12 HIToolbox 0x196c04c2c ReceiveNextEventCommon + 376
13 HIToolbox 0x196c04a9c _BlockUntilNextEventMatchingListInModeWithFilter + 72
14 AppKit 0x190bc8ce0 _DPSNextEvent + 844
15 AppKit 0x190bc7584 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1332
16 XojoFramework 0x102e6ade4 0x102ddc000 + 585188
17 AppKit 0x190e7af7c -[NSApplication _doModalLoop:peek:] + 308
18 AppKit 0x190ff11c4 __33-[NSApplication runModalSession:]_block_invoke_2 + 96
19 AppKit 0x190ff1148 __33-[NSApplication runModalSession:]_block_invoke + 116
20 AppKit 0x190e79198 _NSTryRunModal + 128
21 AppKit 0x190ff1004 -[NSApplication runModalSession:] + 148
22 XojoFramework 0x102fec030 ModalEvents(unsigned char) + 76
23 XojoFramework 0x103000e74 RuntimeShowModalWithinWindow + 356
24 Comos 0x100aa27bc Window.ShowModal%%o<Window> + 44
25 Comos 0x10186ca9c ZoekOfferte.ZoekOfferte.ZoekenOff%s%o<ZoekOfferte.ZoekOfferte>bs + 396
26 Comos 0x100e2e484 Offertescherm.Offertescherm.ButZoekOfferte_Action%%o<Offertescherm.Offertescherm>o<PushButton> + 828
27 Comos 0x10104cc4c Delegate.IM_Invoke%%o<PushButton> + 60
28 Comos 0x10104c610 AddHandler.Stub.15%% + 56
29 AppKit 0x190dcd0c0 -[NSApplication(NSResponder) sendAction:to:from:] + 456
30 AppKit 0x190dccec0 -[NSControl sendAction:to:] + 96
31 AppKit 0x190dccdc8 __26-[NSCell _sendActionFrom:]_block_invoke + 152
32 AppKit 0x190dcccbc -[NSCell _sendActionFrom:] + 196
33 AppKit 0x190dccbe8 -[NSButtonCell _sendActionFrom:] + 104
34 AppKit 0x190dc9a28 NSControlTrackMouse + 1720
35 AppKit 0x190dc9344 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 160
36 AppKit 0x190dc91b8 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 740
37 AppKit 0x190dc8420 -[NSControl mouseDown:] + 636
38 XojoFramework 0x102e6efcc 0x102ddc000 + 602060
39 AppKit 0x190dc6874 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4524
40 AppKit 0x190d39ce4 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2444
41 AppKit 0x190d390ec -[NSWindow(NSEventRouting) sendEvent:] + 348
42 XojoFramework 0x102e7ba60 0x102ddc000 + 653920
43 AppKit 0x190d38050 -[NSApplication(NSEvent) sendEvent:] + 2776
44 XojoFramework 0x102e6ad48 0x102ddc000 + 585032
45 Comos 0x100ad1c54 Application._CallFunctionWithExceptionHandling%%o<Application>p + 164
46 XojoFramework 0x102febf54 CallFunctionWithExceptionHandling(void (*)()) + 180
47 XojoFramework 0x102e6acf8 0x102ddc000 + 584952
48 AppKit 0x190ff059c -[NSApplication _handleEvent:] + 76
49 AppKit 0x190bb95cc -[NSApplication run] + 636
50 XojoFramework 0x102fea7bc RuntimeRun + 48
51 Comos 0x100b91df4 REALbasic._RuntimeRun + 28
52 Comos 0x101b0d7b8 _Main + 528
53 Comos 0x101b08440 main + 36
54 dyld 0x1023410f4 start + 520
Thread 1:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x18df6d954 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x18df6dd00 mach_msg + 76
2 CoreFoundation 0x18e074ed8 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x18e073390 __CFRunLoopRun + 1212
4 CoreFoundation 0x18e072734 CFRunLoopRunSpecific + 600
5 AppKit 0x190d35c90 _NSEventThread + 196
6 libsystem_pthread.dylib 0x18dfa9240 _pthread_start + 148
7 libsystem_pthread.dylib 0x18dfa4024 thread_start + 8
Thread 2:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 6:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 8:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 9:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 10:
0 libsystem_pthread.dylib 0x18dfa4010 start_wqthread + 0
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000001 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x000000012680a584
x4: 0x0000000000002800 x5: 0x0000000000000020 x6: 0x0000000000000025 x7: 0x0000000000000000
x8: 0x0000000000000001 x9: 0x000000018deebe77 x10: 0x0000000000000001 x11: 0x0000000000000000
x12: 0x0000000000000048 x13: 0x00000000e8820825 x14: 0x0000000000000010 x15: 0x0000000000021000
x16: 0x000000018dfbd880 x17: 0x00000001e8781fe0 x18: 0x0000000158193940 x19: 0x000000016f3bd050
x20: 0x0000000000000001 x21: 0x000000012680cdf0 x22: 0x000000000000006b x23: 0x0000000000000073
x24: 0x000000000000000a x25: 0x000000016f3bd168 x26: 0x000000016f3bd160 x27: 0x0000000000000000
x28: 0x000000012680cdf2 fp: 0x000000016f3bd420 lr: 0x000000018de70548
sp: 0x000000016f3bd050 pc: 0x000000018dfbd884 cpsr: 0x20001000
far: 0x0000000000000000 esr: 0x92000006 (Data Abort) byte read Translation fault
Binary Images:
0x18dfbc000 - 0x18dfc3fff libsystem_platform.dylib (*) <ef6555f4-7a8e-3e51-9b40-5381482dee4d> /usr/lib/system/libsystem_platform.dylib
0x18de6d000 - 0x18deedfff libsystem_c.dylib (*) <00fc01c7-36bc-3193-86a3-5c03046b45fb> /usr/lib/system/libsystem_c.dylib
0x196bd2000 - 0x196f01fff com.apple.HIToolbox (2.1.1) <01b981b8-a2d8-374d-9a0e-c4ac8c1009da> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
0x190b87000 - 0x191a3afff com.apple.AppKit (6.9) <a8bbc643-113d-310f-96b6-77a973bf2dba> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x102ddc000 - 0x1030fffff com.xojo.XojoFramework (1.0) <4a5f8de8-eefe-37a6-ba0d-bf7cb4ecd1fb> /Applications/Comos/Comos.app/Contents/Frameworks/XojoFramework.framework/Versions/A/XojoFramework
0x100a40000 - 0x101c73fff com.Comatherm.Comos (*) <0534df7f-f4f8-3ee9-b9eb-bdba8f4a33e8> /Applications/Comos/Comos.app/Contents/MacOS/Comos
0x10233c000 - 0x10239bfff dyld (*) <7e92b284-4b90-3b68-b31a-3ddc4c0e8d40> /usr/lib/dyld
0x18df6c000 - 0x18dfa1fff libsystem_kernel.dylib (*) <c8b3081a-5081-3a99-bbe3-01413de444c6> /usr/lib/system/libsystem_kernel.dylib
0x18dff0000 - 0x18e533fff com.apple.CoreFoundation (6.9) <f5ea9592-4ef9-3d35-b23d-5c21283acc52> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x18dfa2000 - 0x18dfaefff libsystem_pthread.dylib (*) <ed328b18-eeef-3b15-8858-798b19b0c2cd> /usr/lib/system/libsystem_pthread.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0