Prevent QWindow transient parent loop

Clients may wrongly set the transient parent to the window itself,
causing endless loop when e.g. looking for the top level parent.

Change-Id: Ib23cae3a5576320435ae9b76dd618d1e5ae08b5d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-04-10 21:07:11 +02:00
parent 6e649f9714
commit 7f29367c09

View File

@ -1279,6 +1279,10 @@ void QWindow::setTransientParent(QWindow *parent)
qWarning() << parent << "must be a top level window.";
return;
}
if (parent == this) {
qWarning() << "transient parent" << parent << "can not be same as window";
return;
}
d->transientParent = parent;