Windows QPA: Do not double delete the QTouchDevice
This caused a crash on destruction because as soon as you construct a QTouchDevice it will register itself to a list of devices. On application exit the function cleanupDevicesList() in qtouchdevice.cpp would go through all registered QTouchDevices and destroy them. Therefore, there is no need to delete the QTouchDevice from QWindowsPointerHandler. This was a regression that was caused by 20d6dac63c25d227ed5315801e3e853ee78ec248 Change-Id: I58fb50016c047c3843a3f9677f2c2ef824223d43 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
This commit is contained in:
parent
4fdda5a584
commit
540525bceb
@ -239,8 +239,8 @@ static QTouchDevice *createTouchDevice()
|
||||
QTouchDevice *QWindowsPointerHandler::ensureTouchDevice()
|
||||
{
|
||||
if (!m_touchDevice)
|
||||
m_touchDevice.reset(createTouchDevice());
|
||||
return m_touchDevice.data();
|
||||
m_touchDevice = createTouchDevice();
|
||||
return m_touchDevice;
|
||||
}
|
||||
|
||||
Qt::MouseButtons QWindowsPointerHandler::queryMouseButtons()
|
||||
@ -400,7 +400,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd,
|
||||
touchPoints.append(touchPoint);
|
||||
}
|
||||
|
||||
QWindowSystemInterface::handleTouchEvent(window, m_touchDevice.data(), touchPoints,
|
||||
QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints,
|
||||
QWindowsKeyMapper::queryKeyboardModifiers());
|
||||
|
||||
if (!(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) {
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
QWindowsPointerHandler() = default;
|
||||
bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
|
||||
bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
|
||||
QTouchDevice *touchDevice() const { return m_touchDevice.data(); }
|
||||
QTouchDevice *touchDevice() const { return m_touchDevice; }
|
||||
QTouchDevice *ensureTouchDevice();
|
||||
Qt::MouseButtons queryMouseButtons();
|
||||
QWindow *windowUnderMouse() const { return m_windowUnderPointer.data(); }
|
||||
@ -70,7 +70,7 @@ private:
|
||||
bool translateTouchEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vTouchInfo, unsigned int count);
|
||||
bool translatePenEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vPenInfo);
|
||||
|
||||
QScopedPointer<QTouchDevice> m_touchDevice;
|
||||
QTouchDevice *m_touchDevice = nullptr;
|
||||
QHash<int, QPointF> m_lastTouchPositions;
|
||||
QPointer<QWindow> m_windowUnderPointer;
|
||||
QPointer<QWindow> m_currentWindow;
|
||||
|
Loading…
x
Reference in New Issue
Block a user