Qt: fixed destroyAllWindow crash (patch #794)

This commit is contained in:
Ilya Lysenkov 2011-06-16 15:48:01 +00:00
parent f010539aaf
commit 480f8235a7

View File

@ -988,16 +988,25 @@ void GuiReceiver::destroyAllWindow()
//#TODO check externalQAppExists and in case it does, close windows carefully, //#TODO check externalQAppExists and in case it does, close windows carefully,
// i.e. apply the className-check from below... // i.e. apply the className-check from below...
qApp->closeAllWindows(); qApp->closeAllWindows();
}else{ }
else
foreach (QObject *obj, QApplication::topLevelWidgets())
{ {
bool isWidgetDeleted = true;
while(isWidgetDeleted)
{
isWidgetDeleted = false;
QWidgetList list = QApplication::topLevelWidgets();
for (int i = 0; i < list.count(); i++)
{
QObject *obj = list.at(i);
if (obj->metaObject ()->className () == QString("CvWindow")) if (obj->metaObject ()->className () == QString("CvWindow"))
{ {
delete obj; delete obj;
isWidgetDeleted = true;
break;
}
} }
} }
} }
} }