Mercurial > hg > octave-nkf
changeset 16637:b3f4bdd7e5f4
fix endless loop when closing all files in the editor and files are modified
* file_editor.cc(request_close_all_files,request_close_other_files):
delete the tabs starting with the last otherwise deleting changes the indexes
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 11 May 2013 14:01:15 +0200 |
parents | d788ee8b8a99 |
children | 3c2e457eeb72 |
files | libgui/src/m-editor/file-editor.cc |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -632,23 +632,20 @@ void file_editor::request_close_all_files (bool) { - int index; - while ((index = _tab_widget->currentIndex ()) > -1) + // loop over all tabs starting from last one otherwise deletion changes index + for (int index = _tab_widget->count ()-1; index >= 0; index--) emit fetab_close_request (_tab_widget->widget (index)); } void file_editor::request_close_other_files (bool) { - int index = 0; QWidget *tabID = _tab_widget->currentWidget (); - - while (_tab_widget->count () > 1) + // loop over all tabs starting from last one otherwise deletion changes index + for (int index = _tab_widget->count ()-1; index >= 0; index--) { if (tabID != _tab_widget->widget (index)) emit fetab_close_request (_tab_widget->widget (index)); - else - index++; } }