Maximum number of rows in a Popupmenu?

My app has a DesktopPopupMenu with 38 items (rows) which are predefined in the Opening event using me.addrow“…“. In debug mode the app ran without complaints. But when I built the app it took twice as long as usual and the app crashed immediately. So I divided the Popupmenu into 2 and all was fine again.

So my question is: what is the maximum number of rows allowed in a DesktopPopupMenu and why doesn’t it crash in debug mode?

Xojo 2025 R 2.1

MacOS 26.0.1

iMac M1

I have popupmenu with much more than 38 items.

We have been using Xojo for a bit, and we have not had problems with adding many more rows than that to a DesktopPopupMenu.

I would recommend adding some logging statements to report on the conditions and timing for each row insert (possible suspects include: file access, network access, database queries).

If you want to remove the DesktopPopupMenu from the equation, as a temporary measure, try populating an array with the data (rather than the DesktopPopupMenu), and then output the contents of the Array to a Textbox that can be viewed in a built app. This could reveal some useful information.

38 Rows in a PopupMenu ?

Fortunately, on macOS, typing a character (A…Z) make a jump to the first entry with that character (A…Z), because a PopupMenu that is taller than the screen height… will be boring after some consecutive uses… IMHO.

Please show your code, best would be an example. Can you add the relevant section of the crash log?

There was another thread floating around that mentioned a confirmed Xojo issue dealing with Popupmenus on MacOS 26. You may be running into the same.

1 Like

A part of the Diagnostic Report:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process:             
Path:               
Identifier:         
Version:             
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           
User ID:             

Date/Time:           2025-10-03 13:15:28.6054 +0200
Launch Time:         2025-10-03 13:15:19.0405 +0200
Hardware Model:      iMac21,1
OS Version:          macOS 26.0.1 (25A362)
Release Type:        User

Crash Reporter Key:  FF98D09D-8978-C962-E47B-5E2EC8870A39
Incident Identifier: D8B3F1B8-C144-4720-A101-400F61E138D6

Time Awake Since Boot: 9800 seconds

System Integrity Protection: enabled

Triggered by Thread: 0

Exception Type:    EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000feaa9870
Exception Codes:   0x0000000000000001, 0x00000000feaa9870

Termination Reason:  Namespace SIGNAL, Code 11, Segmentation fault: 11
Terminating Process: exc handler [25509]


VM Region Info: 0xfeaa9870 is not in any region.  Bytes before following region: 98740112
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      1048d4000-1072b8000    [ 41.9M] r-x/r-x SM=COW  /Users/USER/Documents/*/Kurzweil.app/Contents/MacOS/Kurzweil

Thread 0 Crashed:
0   ???                           	        0xfeaa9870 ???
1   XojoFramework                 	       0x107e1dc18 ComboBox::Change() + 312
2   XojoFramework                 	       0x107e1daa8 PopupMenu::Change() + 88
3   AppKit                        	       0x1a28f9b08 -[NSApplication(NSResponder) sendAction:to:from:] + 560
4   AppKit                        	       0x1a252e6e0 -[NSControl sendAction:to:] + 72
5   AppKit                        	       0x1a24b7d1c __26-[NSCell _sendActionFrom:]_block_invoke + 100
6   AppKit                        	       0x1a24b7c44 -[NSCell _sendActionFrom:] + 204
7   AppKit                        	       0x1a247dae0 -[NSButtonCell _sendActionFrom:] + 96
8   AppKit                        	       0x1a280cf70 -[NSPopUpButtonCell _withAnimatedImageUpdatesIfApplicable:] + 92
9   AppKit                        	       0x1a280bfa8 __38-[NSPopUpButtonCell _popUpItemAction:]_block_invoke + 100
10  AppKit                        	       0x1a280bf00 -[NSPopUpButtonCell _popUpItemAction:] + 168
11  AppKit                        	       0x1a28f9b08 -[NSApplication(NSResponder) sendAction:to:from:] + 560
12  AppKit                        	       0x1a272eb6c -[NSMenuItem _corePerformAction:] + 540
13  AppKit                        	       0x1a292a43c _NSMenuPerformActionWithHighlighting + 160
14  AppKit                        	       0x1a270c928 -[NSMenu performActionForItemAtIndex:] + 208
15  AppKit                        	       0x1a270ca58 -[NSMenu _internalPerformActionForItemAtIndex:invocationType:] + 84
16  AppKit                        	       0x1a291ff98 +[NSCocoaMenuImpl _performActionForMenuItem:invocationType:] + 184
17  AppKit                        	       0x1a26a3388 -[NSMenuTrackingSession _performPostTrackingDismissalActions] + 488
18  AppKit                        	       0x1a26a2fc8 -[NSMenuTrackingSession startRunningMenuEventLoop:] + 1532
19  AppKit                        	       0x1a26a2958 -[NSMenuTrackingSession startMonitoringEvents:] + 284
20  AppKit                        	       0x1a2ebf0c0 -[NSContextMenuTrackingSession startMonitoringEvents:] + 84
21  AppKit                        	       0x1a264149c +[NSContextMenuImpl presentPopup:fromView:withContext:animated:] + 1116
22  AppKit                        	       0x1a292bb64 _NSPopUpMenu + 2148
23  AppKit                        	       0x1a292b22c -[NSCocoaMenuImpl popUpMenu:atLocation:width:view:selectedItemIndexProvider:font:positioningRect:flags:options:] + 432
24  AppKit                        	       0x1a280b4f0 -[NSPopUpButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 640
25  AppKit                        	       0x1a2b28854 -[NSControl(_NSTracking) _mouseDown:] + 612
26  AppKit                        	       0x1a2b285c4 -[NSControl(_NSTracking) mouseDown:] + 104
27  XojoFramework                 	       0x107cf0af4 0x107c04000 + 969460
28  AppKit                        	       0x1a2beab58 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3676
29  AppKit                        	       0x1a2be79e0 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 492
30  AppKit                        	       0x1a2be7470 -[NSWindow(NSEventRouting) sendEvent:] + 372
31  XojoFramework                 	       0x107cfabb4 0x107c04000 + 1010612
32  AppKit                        	       0x1a28f64ac -[NSApplication(NSEventRouting) sendEvent:] + 1276
33  XojoFramework                 	       0x107cea5c8 0x107c04000 + 943560
34  Kurzweil                      	       0x104bffca4 DesktopApplication._CallFunctionWithExceptionHandling%%o<DesktopApplication>p + 164
35  XojoFramework                 	       0x107e6f260 CallFunctionWithExceptionHandling(void (*)()) + 180
36  XojoFramework                 	       0x107cea578 0x107c04000 + 943480
37  AppKit                        	       0x1a23f06ec -[NSApplication _handleEvent:] + 60
38  AppKit                        	       0x1a1e9d748 -[NSApplication run] + 408
39  XojoFramework                 	       0x107e6d950 RuntimeRun + 60
40  Kurzweil                      	       0x104c693b4 REALbasic._RuntimeRun + 28
41  Kurzweil                      	       0x107207c08 _Main + 356
42  Kurzweil                      	       0x1071b8334 main + 20
43  dyld                          	       0x19d659d54 start + 7184

Thread 1:

Thread 2:

Thread 3:

Thread 4:

Thread 5:

Thread 6:

Thread 7:: com.apple.NSEventThread
0   libsystem_platform.dylib      	       0x19da22160 _platform_memset + 208
1   libsystem_c.dylib             	       0x19d8b6120 __lshift_D2A + 104
2   libsystem_c.dylib             	       0x19d8b4874 __dtoa + 2296
3   libsystem_c.dylib             	       0x19d8a753c __vfprintf + 2772
4   libsystem_c.dylib             	       0x19d8d2e94 _vsnprintf + 212
5   libsystem_c.dylib             	       0x19d8b1580 snprintf + 68
6   SkyLight                      	       0x1a43c5d80 (anonymous namespace)::EventLog::getLogString() const + 376
7   SkyLight                      	       0x1a43c70f0 (anonymous namespace)::MouseEventLog::getLogString() const + 80
8   SkyLight                      	       0x1a43c54fc CGSEventLogEvent + 988
9   SkyLight                      	       0x1a42ef414 SLSGetNextEventRecordInternal + 364
10  SkyLight                      	       0x1a426ad4c SLEventCreateNextEvent + 20
11  HIToolbox                     	       0x1aa4ae13c PullEventsFromWindowServerOnConnection(unsigned int, unsigned char, __CFMachPortBoost*) + 80
12  HIToolbox                     	       0x1aa4ab528 MessageHandler(__CFMachPort*, void*, long, void*) + 60
13  CoreFoundation                	       0x19dad56b4 __CFMachPortPerform + 240
14  CoreFoundation                	       0x19dab8054 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60
15  CoreFoundation                	       0x19dab7f7c __CFRunLoopDoSource1 + 508
16  CoreFoundation                	       0x19dab69ac __CFRunLoopRun + 2168
17  CoreFoundation                	       0x19db74898 _CFRunLoopRunSpecificWithOptions + 532
18  AppKit                        	       0x1a1f34a68 _NSEventThread + 184
19  libsystem_pthread.dylib       	       0x19da18c08 _pthread_start + 136
20  libsystem_pthread.dylib       	       0x19da13ba8 thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000218437a00   x2: 0x000000020a41b2b8   x3: 0x0000000000000000
    x4: 0x000000006e656d6f   x5: 0x000000006e656d6f   x6: 0x000000000000006e   x7: 0x0000000000000000
    x8: 0x00000000feaa9870   x9: 0x00000001056a9608  x10: 0x000000012c69d510  x11: 0x000000000000007f
   x12: 0x0000000000000074  x13: 0x000000013e14cf30  x14: 0x010000020a3e6711  x15: 0x000000020a3e6710
   x16: 0x0000000000000000  x17: 0x0000600003783d20  x18: 0x0000000000000000  x19: 0x0000000000000001
   x20: 0x0000000000000000  x21: 0x0000000000000000  x22: 0x0000000104d97978  x23: 0x0000000000000001
   x24: 0x000060000008cdc0  x25: 0x0000000203ffd000  x26: 0x0000000000000001  x27: 0x00006000022872c0
   x28: 0x000000013e8068a0   fp: 0x000000016b52a100   lr: 0x000000010585dc7c
    sp: 0x000000016b5264c0   pc: 0x00000000feaa9870 cpsr: 0x80001000
   far: 0x00000000feaa9870  esr: 0x82000006 (Instruction Abort) Translation fault