summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2013-11-29 18:14:49 +0000
committerManolo Gouy <Manolo>2013-11-29 18:14:49 +0000
commit05dd61d4eee1801fc51c5009a1295836020ace9e (patch)
tree92a6772f7610eb8ceec1adeadb21e6e1851136d4 /src
parent8f34835c17512d6856c5d34873625d09f33afa5e (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm7
1 files changed, 7 insertions, 0 deletions
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;