# HG changeset patch # User Olaf Wintermann # Date 1781202937 -7200 # Node ID 7dcd5994c9a58565f1ba71d7fc0b179c8f78e171 # Parent 6efc3994e8dde82e79dad9112a3a2b5fb6a0f976 only init global menubar, when menus were created (Cocoa) diff -r 6efc3994e8dd -r 7dcd5994c9a5 ui/cocoa/AppDelegate.m --- a/ui/cocoa/AppDelegate.m Thu Jun 11 20:27:11 2026 +0200 +++ b/ui/cocoa/AppDelegate.m Thu Jun 11 20:35:37 2026 +0200 @@ -38,11 +38,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSLog(@"toolkit applicationDidFinishLaunching"); - ui_menu_init(); uic_application_startup(NULL); - // run ui_menu_init again, because it is possible, that the startup func - // added menus (which is probably true when using other language bindings) - // the menu init func can be called multiple times and is also called + // The menu init func can be called multiple times and is also called // when a new window is created // The only usecase for calling init here is, that an application might not // open a window on startup, but wants a working menubar diff -r 6efc3994e8dd -r 7dcd5994c9a5 ui/cocoa/menu.m --- a/ui/cocoa/menu.m Thu Jun 11 20:27:11 2026 +0200 +++ b/ui/cocoa/menu.m Thu Jun 11 20:35:37 2026 +0200 @@ -189,15 +189,16 @@ static BOOL menu_is_initialized = NO; void ui_menu_init(void) { - if(menu_is_initialized) { + UiMenu *menus_begin = uic_get_menu_list(); + UiMenu *ls = menus_begin; + + if(menu_is_initialized || !ls) { return; } menu_is_initialized = YES; bindingItems = [[NSMutableArray alloc] init]; - UiMenu *menus_begin = uic_get_menu_list(); - UiMenu *ls = menus_begin; int index = 1; while(ls) { if(ls->item.type == UI_MENU) {