From 05dd61d4eee1801fc51c5009a1295836020ace9e Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 29 Nov 2013 18:14:49 +0000 Subject: Fix STR#3010: Program can crash under Mac OS when a dialog window is closed if the opening of this dialog window made the previous window to be redrawn. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10021 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 7e72e3cf9..7dddecb53 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1040,7 +1040,14 @@ static void cocoaMouseHandler(NSEvent *theEvent) - (BOOL)windowShouldClose:(id)fl { fl_lock_function(); + NSView *old_focus = [NSView focusView]; Fl::handle( FL_CLOSE, [(FLWindow *)fl getFl_Window] ); // this might or might not close the window + NSView *new_focus = [NSView focusView]; + // the currently focused view can have changed + if (new_focus != old_focus) { + // in that case it is necessary to remove the new lock (see STR #3010) + [new_focus unlockFocus]; + } fl_unlock_function(); // the system doesn't need to send [fl close] because FLTK does it when needed return NO; -- cgit v1.2.3