QPlatformWindow: fix isAncestorOf not breaking recursion

The current implementation got stuck always asking for
the parent of the same child

This patch will make sure we actually walk up the
parent chain.

Change-Id: I9f67f6305e0143526f53952a563d496e760ac2e7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f06f39779c11cabc9b4fc281f38c80edb65bd86a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Richard Moe Gustavsen 2021-09-13 16:41:08 +02:00 committed by Qt Cherry-pick Bot
parent ee23accac7
commit 7b930750b1

View File

@ -229,7 +229,7 @@ bool QPlatformWindow::isActive() const
*/ */
bool QPlatformWindow::isAncestorOf(const QPlatformWindow *child) const bool QPlatformWindow::isAncestorOf(const QPlatformWindow *child) const
{ {
for (const QPlatformWindow *parent = child->parent(); parent; parent = child->parent()) { for (const QPlatformWindow *parent = child->parent(); parent; parent = parent->parent()) {
if (parent == this) if (parent == this)
return true; return true;
} }