ecore-wl2: do not unref non-matching input device upon removal
authorMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 2 Jun 2017 22:23:44 +0000 (18:23 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 2 Jun 2017 22:23:42 +0000 (18:23 -0400)
this is how you avoid crashing

@fix

src/lib/ecore_wl2/ecore_wl2_input.c

index 5101390..693a3ad 100644 (file)
@@ -1543,17 +1543,17 @@ _ecore_evas_wl_common_cb_device_event(void *data, int type, void *event)
         return ECORE_CALLBACK_PASS_ON;
      }
 
-   if (ev->type == ECORE_WL2_DEVICE_TYPE_POINTER && devices->pointer_dev)
+   if ((ev->type == ECORE_WL2_DEVICE_TYPE_POINTER) && (devices->pointer_dev == ev->dev))
      {
         efl_unref(devices->pointer_dev);
         devices->pointer_dev = NULL;
      }
-   else if (ev->type == ECORE_WL2_DEVICE_TYPE_KEYBOARD && devices->keyboard_dev)
+   else if ((ev->type == ECORE_WL2_DEVICE_TYPE_KEYBOARD) && (devices->keyboard_dev == ev->dev))
      {
         efl_unref(devices->keyboard_dev);
         devices->keyboard_dev = NULL;
      }
-   else if (ev->type == ECORE_WL2_DEVICE_TYPE_TOUCH && devices->touch_dev)
+   else if ((ev->type == ECORE_WL2_DEVICE_TYPE_TOUCH) && (devices->touch_dev == ev->dev))
      {
         efl_unref(devices->touch_dev);
         devices->touch_dev = NULL;