High DPI: Fix crash in QWindow::mapFromGlobal()
With Web Engine, QQuickWidget or similar, the code can hit on the offscreen
window, when its handle is null. Add a check.
Amends 3af7b27917
.
Fixes: QTBUG-76440
Change-Id: I123633d18386efd3dbfb22aad6072e4f0877a62e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
a3e69954f5
commit
6d61b10f65
@ -400,7 +400,7 @@ QPoint QHighDpiScaling::mapPositionToGlobal(const QPoint &pos, const QPoint &win
|
||||
QPoint QHighDpiScaling::mapPositionFromGlobal(const QPoint &pos, const QPoint &windowGlobalPosition, const QWindow *window)
|
||||
{
|
||||
QPoint windowPosCandidate = pos - windowGlobalPosition;
|
||||
if (QGuiApplicationPrivate::screen_list.size() <= 1)
|
||||
if (QGuiApplicationPrivate::screen_list.size() <= 1 || window->handle() == nullptr)
|
||||
return windowPosCandidate;
|
||||
|
||||
// Device independent global (screen) space may discontiguous when high-dpi scaling
|
||||
|
Loading…
Reference in New Issue
Block a user