Prevent crashing the compositor when the client wants to unset the cursor.
authorSamuel Rødal <samuel.rodal@digia.com>
Fri, 21 Sep 2012 23:13:02 +0000 (01:13 +0200)
committerJørgen Lind <jorgen.lind@gmail.com>
Sat, 22 Sep 2012 08:44:42 +0000 (10:44 +0200)
Change-Id: I40460110e24555aacaef928af32372c32a3291d1
Reviewed-by: Jørgen Lind <jorgen.lind@gmail.com>
src/compositor/wayland_wrapper/wlinputdevice.cpp

index c3e977e..41cbc38 100644 (file)
@@ -518,7 +518,7 @@ void InputDevice::pointer_attach(struct wl_client *client,
     InputDevice *inputDevice = wayland_cast<InputDevice>(pointer->seat);
     wl_buffer *buffer = reinterpret_cast<wl_buffer *>(buffer_resource);
 
-    if (wl_buffer_is_shm(buffer)) {
+    if (buffer && wl_buffer_is_shm(buffer)) {
         int stride = wl_shm_buffer_get_stride(buffer);
         uint format = wl_shm_buffer_get_format(buffer);
         (void) format;
@@ -530,6 +530,8 @@ void InputDevice::pointer_attach(struct wl_client *client,
             delete currentCursor;
             currentCursor = img;
         }
+    } else {
+        inputDevice->m_compositor->waylandCompositor()->changeCursor(QImage(), x, y);
     }
 }