diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-12-20 10:59:19 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-12-20 10:59:19 +0100 |
| commit | f68dee3288202259fb2b417a590c462e3f4ff658 (patch) | |
| tree | 693b643dafaa2af2d8da9abd8b33ec1481fed1b3 /src | |
| parent | 896112ca829f9d253998cc5153d2c40f4a885777 (diff) | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_cocoa.mm | 5 |
1 files changed, 3 insertions, 2 deletions
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 |
