From d0740edb9c77bba7fb156dcda18459e2a23a6d04 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Fri, 1 May 2015 17:41:17 +0300 Subject: [PATCH] Fix crash on keyboard remove If the compositor sent a wl_keyboard.leave and a new wl_seat.capabilities without the keyboard bit we would end up deleting the Keyboard object with a roundtrip in flight, ending up using freed memory later. Destroy the callback when destroying the keyboard, and notify the window system the active window is active no more. Change-Id: Ie415ca62b46e0b8ef0fe4d09c8e7a8130928df90 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 8c896528024..b2268ae7888 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -118,6 +118,10 @@ QWaylandInputDevice::Keyboard::~Keyboard() #ifndef QT_NO_WAYLAND_XKB releaseKeyMap(); #endif + if (mFocus) + QWindowSystemInterface::handleWindowActivated(0); + if (mFocusCallback) + wl_callback_destroy(mFocusCallback); if (mParent->mVersion >= 3) wl_keyboard_release(object()); else