Do not assert in pointer and keyboard enter
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Fri, 11 May 2012 05:56:06 +0000 (08:56 +0300)
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>
Fri, 11 May 2012 06:07:43 +0000 (08:07 +0200)
Handle the case of null surface gracefully. It can be null if the
surface is destroyed on client side and the object is in zombie state
still.

Change-Id: Ife67180e6405a521562a43c24d377559d7848b6f
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/plugins/platforms/wayland/qwaylandinputdevice.cpp

index 4a92b6f..7cfe56d 100644 (file)
@@ -399,8 +399,8 @@ void QWaylandInputDevice::inputHandlePointerEnter(void *data,
     Q_UNUSED(sy);
     QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data;
 
-    // shouldn't get pointer enter with no surface
-    Q_ASSERT(surface);
+    if (!surface)
+        return;
 
     QWaylandWindow *window = (QWaylandWindow *) wl_surface_get_user_data(surface);
     window->handleMouseEnter();
@@ -447,8 +447,8 @@ void QWaylandInputDevice::inputHandleKeyboardEnter(void *data,
     inputDevice->mModifiers |= translateModifiers(inputDevice->mXkbState);
 #endif
 
-    // shouldn't get keyboard enter with no surface
-    Q_ASSERT(surface);
+    if (!surface)
+        return;
 
     window = (QWaylandWindow *) wl_surface_get_user_data(surface);
     inputDevice->mKeyboardFocus = window;