# HG changeset patch # User Torsten # Date 1423603649 -3600 # Node ID b30cd22e6471a713344b1a1ea58889a033277ffc # Parent 480f0fc56bbf6e85866cc299b418ee3d481cd8b1 fix reappearing closed editor tabs at next restart (bug #44219) * file-editor.cc (constructor): init flag for closing-check; (destructor): call check_closing only if this check is not yet done; (check_closing): set flag in order to indicate that check is done * file-editor.h: new flag diff -r 480f0fc56bbf -r b30cd22e6471 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Tue Feb 10 02:37:29 2015 -0600 +++ b/libgui/src/m-editor/file-editor.cc Tue Feb 10 22:27:29 2015 +0100 @@ -54,6 +54,8 @@ // files will change ced accordingly. ced = QDir::currentPath (); + _check_closing_done = false; // init flag for closing process + construct (); setVisible (false); @@ -64,9 +66,13 @@ file_editor::~file_editor (void) { // Close open tabs, if existing. In this case app closing must be - // initiated by octave. All tabs will be definetly closed and the + // initiated by octave since check_closing was already done if the gui + // initiated the closing. All tabs will be definetly closed and the // user can not cancel exiting (close state -1) - if (_tab_widget->count ()) + // We have to prevent that on case of gui-closing this check is done + // a second time resulting in an empty file list (tabs closed) for the + // the next start, that is what _check_closing_done is for + if (! _check_closing_done) check_closing (-1); if (_mru_file_menu) @@ -109,6 +115,8 @@ } // Here, we really want to exit and all tabs are closed + _check_closing_done = true; // check is already done, prevent a second check + // which would store an empty file list return true; } diff -r 480f0fc56bbf -r b30cd22e6471 libgui/src/m-editor/file-editor.h --- a/libgui/src/m-editor/file-editor.h Tue Feb 10 02:37:29 2015 -0600 +++ b/libgui/src/m-editor/file-editor.h Tue Feb 10 22:27:29 2015 +0100 @@ -351,6 +351,8 @@ QMenu *_mru_file_menu; QAction *_mru_file_actions[MaxMRUFiles]; QStringList _mru_files; + + bool _check_closing_done; }; #endif // FILEEDITORMDISUBWINDOW_H