diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-06-07 12:37:10 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-08 08:02:13 +0200 |
commit | 94a81928ac3ba8fc0ccb17eba7328cba5be56323 (patch) | |
tree | e557e2dec069d41d22ae0f6be106489a67c390be /src/widgets/kernel/qwidget_qpa.cpp | |
parent | 21e0d164110a4a1ff824e4014957353765542c2d (diff) |
Fix a crash when calling effectiveWinId() on parentless widgets.
Remove the assert as it also triggers when the widget is one
that currently has no parent (setParent(0)).
Check that the WinId is != 0 in the cursor code.
Change-Id: I711fc600f1d803c8f01c15df87984e742a4c23d2
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget_qpa.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 355af1740e..8a6ceac526 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -989,8 +989,11 @@ void qt_qpa_set_cursor(QWidget *w, bool force) static QPointer<QWidget> lastUnderMouse = 0; if (force) { lastUnderMouse = w; - } else if (lastUnderMouse && lastUnderMouse->effectiveWinId() == w->effectiveWinId()) { - w = lastUnderMouse; + } else if (lastUnderMouse) { + const WId lastWinId = lastUnderMouse->effectiveWinId(); + const WId winId = w->effectiveWinId(); + if (lastWinId && lastWinId == winId) + w = lastUnderMouse; } else if (!w->internalWinId()) { return; // The mouse is not under this widget, and it's not native, so don't change it. } |