From f68dee3288202259fb2b417a590c462e3f4ff658 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 20 Dec 2019 10:59:19 +0100 Subject: Fix problems after closing full-screen window macOS strangely sends NSViewFrameDidChangeNotification and a drawRect: message to its content view after having sent to the window the close message. That is apparently new in 10.15.2 --- src/Fl_cocoa.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 03691956a..b0a13d714 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1250,7 +1250,7 @@ static FLWindowDelegate *flwindowdelegate_instance = nil; if (![[notif object] isKindOfClass:[FLView class]]) return; FLView *view = (FLView*)[notif object]; FLWindow *nsw = (FLWindow*)[view window]; - if (!nsw) return; + if (!nsw || ![nsw getFl_Window]) return; fl_lock_function(); Fl_Window *window = [nsw getFl_Window]; int X, Y; @@ -2234,9 +2234,10 @@ static FLTextInputContext* fltextinputcontext_instance = nil; */ - (void)drawRect:(NSRect)rect { - fl_lock_function(); FLWindow *cw = (FLWindow*)[self window]; Fl_Window *window = [cw getFl_Window]; + if (!window) return; // may happen after closing full-screen window + fl_lock_function(); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14 CGContextRef gc = views_use_CA ? [[NSGraphicsContext currentContext] CGContext] : NULL; #endif -- cgit v1.2.3