From b4b98c5d57d5608178dfc63a6e56911d22fcfb24 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:20:38 +0100 Subject: macOS: Avoid possible crash in makeMainWindow when another win is modal --- src/Fl_cocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 718d04742..3829188a9 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -4544,7 +4544,7 @@ int Fl_Cocoa_Window_Driver::decorated_h() void Fl_Cocoa_Window_Driver::draw_titlebar_to_context(CGContextRef gc, int w, int h) { FLWindow *nswin = fl_xid(pWindow); - [nswin makeMainWindow]; + if ([nswin canBecomeMainWindow]) [nswin makeMainWindow]; [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO]; CGImageRef img; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -- cgit v1.2.3