Fix possible crash when cleaning up MDI views

This commit is contained in:
wmayer 2012-03-12 10:11:27 +01:00
parent ef852e8f98
commit 02a962207b

View File

@ -56,15 +56,17 @@ MDIView::~MDIView()
//the application crashes when accessing this deleted view.
//This effect only occurs if this widget is not in Child mode, because otherwise
//the focus stuff is done correctly.
QWidget* foc = getMainWindow()->focusWidget();
if (foc) {
QWidget* par = foc;
while (par) {
if (par == this) {
getMainWindow()->setFocus();
break;
if (getMainWindow()) {
QWidget* foc = getMainWindow()->focusWidget();
if (foc) {
QWidget* par = foc;
while (par) {
if (par == this) {
getMainWindow()->setFocus();
break;
}
par = par->parentWidget();
}
par = par->parentWidget();
}
}
}