From 0edbe9987b1196e5a01076e5e65409487844cfb1 Mon Sep 17 00:00:00 2001 From: Angelo Qin Date: Thu, 28 Oct 2021 17:24:59 +0800 Subject: [PATCH] fix DPI scaling crash. --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 6e75b9aa1bb..0c9f0cd90f8 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1889,6 +1889,8 @@ void QWindowsWindow::handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) for (QWindow *childWindow : window()->findChildren()) { QWindowsWindow *platformChildWindow = static_cast(childWindow->handle()); QRect currentGeometry = platformChildWindow->geometry(); + if (!platformChildWindow) + continue; QRect scaledGeometry = QRect(currentGeometry.topLeft() * scale, currentGeometry.size() * scale); platformChildWindow->setGeometry(scaledGeometry); }