From 6ec82c38f0ed751d2e7c67c0732d2d5c043c4a84 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 13 Apr 2012 12:22:14 +0300 Subject: [PATCH] Do not assert when closing dialogs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The leave event may arrive after the window is gone, resulting in a null surface. The callback should do nothing in this case. Change-Id: I36ec4cb1615f518de57b7de98206cdb8986405e4 Reviewed-by: Jørgen Lind --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 2be5946..7ac47f9 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -362,7 +362,7 @@ void QWaylandInputDevice::inputHandlePointerEnter(void *data, Q_UNUSED(sy); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; - // shouldn't get pointer leave with no surface + // shouldn't get pointer enter with no surface Q_ASSERT(surface); QWaylandWindow *window = (QWaylandWindow *) wl_surface_get_user_data(surface); @@ -379,8 +379,10 @@ void QWaylandInputDevice::inputHandlePointerLeave(void *data, Q_UNUSED(input_device); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; - // shouldn't get pointer leave with no surface - Q_ASSERT(surface); + // The event may arrive after destroying the window, indicated by + // a null surface. + if (!surface) + return; QWaylandWindow *window = (QWaylandWindow *) wl_surface_get_user_data(surface); window->handleMouseLeave(); -- 2.7.4