Browse Source

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
pull/49/head
Manolo Gouy 12 years ago
parent
commit
05dd61d4ee
  1. 7
      src/Fl_cocoa.mm

7
src/Fl_cocoa.mm

@ -1040,7 +1040,14 @@ static void cocoaMouseHandler(NSEvent *theEvent) @@ -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;

Loading…
Cancel
Save