Skip to content
Snippets Groups Projects
Commit e522b44d authored by Johan Klokkhammer Helsing's avatar Johan Klokkhammer Helsing Committed by Jani Heikkinen
Browse files

Client: Remove windows from keyboard focus list when destroyed


This fixes the undefined behavior in tst_WaylandClient::touchDrag and mouseDrag

Note: The test still fails if run twice in a row, but it appears to be
deterministic.

Task-number: QTBUG-56187
Change-Id: Ib45d82224f004d1324f2ce4d6b7df05ee36c04f5
Reviewed-by: default avatarPaul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 0049240a)
Reviewed-by: default avatarJohan Helsing <johan.helsing@qt.io>
parent f42acb26
No related branches found
No related tags found
No related merge requests found
......@@ -421,6 +421,12 @@ void QWaylandDisplay::handleKeyboardFocusChanged(QWaylandInputDevice *inputDevic
mLastKeyboardFocus = keyboardFocus;
}
void QWaylandDisplay::handleWindowDestroyed(QWaylandWindow *window)
{
if (mActiveWindows.contains(window))
handleWindowDeactivated(window);
}
void QWaylandDisplay::handleWaylandSync()
{
// This callback is used to set the window activation because we may get an activate/deactivate
......
......@@ -176,6 +176,7 @@ public:
void handleWindowActivated(QWaylandWindow *window);
void handleWindowDeactivated(QWaylandWindow *window);
void handleKeyboardFocusChanged(QWaylandInputDevice *inputDevice);
void handleWindowDestroyed(QWaylandWindow *window);
public slots:
void blockingReadEvents();
......@@ -217,7 +218,7 @@ private:
uint32_t mLastInputSerial;
QWaylandInputDevice *mLastInputDevice;
QPointer<QWaylandWindow> mLastInputWindow;
QWaylandWindow *mLastKeyboardFocus;
QPointer<QWaylandWindow> mLastKeyboardFocus;
QVector<QWaylandWindow *> mActiveWindows;
struct wl_callback *mSyncCallback;
static const wl_callback_listener syncCallbackListener;
......
......@@ -102,6 +102,8 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
QWaylandWindow::~QWaylandWindow()
{
mDisplay->handleWindowDestroyed(this);
delete mWindowDecoration;
if (isInitialized())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment