changeset 23199:cbefc3f49439

fix removing editor tabs on application exit * file-editor.cc (check_closing): use loop with decreasing index since size of _tab_widget changes during loop execution
author Torsten <mttl@mailbox.org>
date Sat, 18 Feb 2017 18:40:15 +0100
parents 8db35b1a4f63
children 239a9fed80de
files libgui/src/m-editor/file-editor.cc
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Fri Feb 10 22:16:16 2017 -0500
+++ b/libgui/src/m-editor/file-editor.cc	Sat Feb 18 18:40:15 2017 +0100
@@ -141,8 +141,9 @@
 
   // Finally close all the tabs and return indication that we can exit
   // the application
-  for (int i = 0; i < _tab_widget->count (); i++)
+  for (int i = _tab_widget->count () - 1; i >= 0; i--)
     {
+      // backwards loop since _tab_widget->count () changes during the loop
       delete _tab_widget->widget (i);
       _tab_widget->removeTab (i);
     }