mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
Qt: fixed destroyAllWindow crash (patch #794)
This commit is contained in:
parent
f010539aaf
commit
480f8235a7
@ -988,16 +988,25 @@ void GuiReceiver::destroyAllWindow()
|
||||
//#TODO check externalQAppExists and in case it does, close windows carefully,
|
||||
// i.e. apply the className-check from below...
|
||||
qApp->closeAllWindows();
|
||||
}else{
|
||||
|
||||
foreach (QObject *obj, QApplication::topLevelWidgets())
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isWidgetDeleted = true;
|
||||
while(isWidgetDeleted)
|
||||
{
|
||||
if (obj->metaObject ()->className () == QString("CvWindow"))
|
||||
isWidgetDeleted = false;
|
||||
QWidgetList list = QApplication::topLevelWidgets();
|
||||
for (int i = 0; i < list.count(); i++)
|
||||
{
|
||||
delete obj;
|
||||
QObject *obj = list.at(i);
|
||||
if (obj->metaObject ()->className () == QString("CvWindow"))
|
||||
{
|
||||
delete obj;
|
||||
isWidgetDeleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user