diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6fffe33ce8..4510fc85b6 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1905,6 +1905,7 @@ bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows processedWindows->append(window); } +retry: QWidgetList list = QApplication::topLevelWidgets(); for (int i = 0; i < list.size(); ++i) { QWidget *w = list.at(i); @@ -1915,8 +1916,7 @@ bool QApplicationPrivate::tryCloseAllWidgetWindows(QWindowList *processedWindows return false; if (window) processedWindows->append(window); - list = QApplication::topLevelWidgets(); - i = -1; + goto retry; } } return true;