diff options
| author | Manolo Gouy <Manolo> | 2014-11-15 21:59:41 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2014-11-15 21:59:41 +0000 |
| commit | 7d6e58acba17c55a6e65cad243ab74aa385beb2f (patch) | |
| tree | e203398be431def9c0d52602e02153711d01367c | |
| parent | 80bd905981c1d010d168057781073c45f4321dc6 (diff) | |
Improves the cmd-Q handler as discussed in FLTK.coredev "Safe widget deletionĀ Ā».
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10457 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_cocoa.mm | 11 |
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; } } |
