diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 28c88ab716..ceb33f6141 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -16,7 +16,8 @@ #include #include -#include + +#include #include @@ -577,15 +578,14 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, const QRect screenGeometry = screen->geometry(); const int winTouchPointCount = int(msg.wParam); - QScopedArrayPointer winTouchInputs(new TOUCHINPUT[winTouchPointCount]); - memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * size_t(winTouchPointCount)); + const auto winTouchInputs = std::make_unique(winTouchPointCount); QTouchPointList touchPoints; touchPoints.reserve(winTouchPointCount); QEventPoint::States allStates; GetTouchInputInfo(reinterpret_cast(msg.lParam), - UINT(msg.wParam), winTouchInputs.data(), sizeof(TOUCHINPUT)); + UINT(msg.wParam), winTouchInputs.get(), sizeof(TOUCHINPUT)); for (int i = 0; i < winTouchPointCount; ++i) { const TOUCHINPUT &winTouchInput = winTouchInputs[i]; int id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1);