summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index e2bf97c46..1ab0118d9 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -1332,11 +1332,12 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
fl_lock_function();
NSApplicationTerminateReply reply = NSTerminateNow;
while ( Fl_X::first ) {
- Fl_X *x = Fl_X::first;
- Fl::handle( FL_CLOSE, x->w );
- Fl::do_widget_deletion();
- if ( Fl_X::first == x ) {
- reply = NSTerminateCancel; // FLTK has not closed all windows, so we return to the main program now
+ Fl_Window *win = Fl::first_window();
+ if (win->parent()) win = win->top_window();
+ Fl_Widget_Tracker wt(win); // track the window object
+ Fl::handle(FL_CLOSE, win);
+ if (wt.exists() && win->shown()) { // the user didn't close win
+ reply = NSTerminateCancel; // so we return to the main program now
break;
}
}