Fix crash because of NULL screen in QXcbWindow

Change-Id: If7bbe3ad1656dadcb098bcd3ece2e7b064eeb44d
Task-number: QTBUG-50081
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This commit is contained in:
Błażej Szczygieł 2016-01-01 20:02:42 +01:00 committed by Shawn Rutledge
parent 7fdfaad43f
commit eaa3a9d010

View File

@ -609,18 +609,16 @@ void QWindow::setParent(QWindow *parent)
}
QObject::setParent(parent);
if (parent)
QPlatformWindow *parentPlatformWindow = parent ? parent->d_func()->platformWindow : Q_NULLPTR;
if (parentPlatformWindow)
d->disconnectFromScreen();
else
d->connectToScreen(newScreen);
if (d->platformWindow) {
if (parent && parent->d_func()->platformWindow) {
d->platformWindow->setParent(parent->d_func()->platformWindow);
} else {
d->platformWindow->setParent(0);
}
}
if (d->platformWindow)
d->platformWindow->setParent(parentPlatformWindow);
d->parentWindow = parent;