# HG changeset patch # User Torsten # Date 1368273675 -7200 # Node ID b3f4bdd7e5f46550e7b5799487300b517d1e2b07 # Parent d788ee8b8a99f59dad09ecfc8a2570621e99111a 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 diff -r d788ee8b8a99 -r b3f4bdd7e5f4 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Fri May 10 18:31:04 2013 -0400 +++ b/libgui/src/m-editor/file-editor.cc Sat May 11 14:01:15 2013 +0200 @@ -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++; } }