From 27316746f55faef191b3a65d587e08d1da84ec4a Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 18 May 2018 13:46:47 -0400 Subject: [PATCH] ee_wayland: Fix device leak on disconnect Summary: A reference was taken on these when they were added, so by passing NULL here we're not allowing that reference to be dropped. This results in not only leaking the device forever, but also potentially leaving it as a default device after it's removed so that no new attach will replace it. Under weston all devices are removed on a VT switch, and when you switch back the default device is wrong, which leads to problems with events like "mouse in" which, for legacy reasons, don't take a seat, but instead look up the default seat. This allows the delete callback to be fired for the first time ever, and while I've tried to fix some bugs this has revealed, I'm not actually sure I've caught them all. Depends on D6182 Reviewers: zmike Reviewed By: zmike Subscribers: cedric, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6183 --- .../engines/wayland/ecore_evas_wayland_common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index e0f9e6e49c..73a7c40f1d 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -1193,7 +1193,8 @@ _ecore_evas_wl_common_cb_seat_capabilities_changed(void *d EINA_UNUSED, int t EI { _ecore_evas_wl_common_device_event_add (ECORE_WL2_EVENT_DEVICE_REMOVED, - ECORE_WL2_DEVICE_TYPE_POINTER, ev->id, NULL, ee); + ECORE_WL2_DEVICE_TYPE_POINTER, ev->id, + device->pointer, ee); evas_device_del(device->pointer); device->pointer = NULL; @@ -1217,7 +1218,8 @@ _ecore_evas_wl_common_cb_seat_capabilities_changed(void *d EINA_UNUSED, int t EI { _ecore_evas_wl_common_device_event_add (ECORE_WL2_EVENT_DEVICE_REMOVED, - ECORE_WL2_DEVICE_TYPE_KEYBOARD, ev->id, NULL, ee); + ECORE_WL2_DEVICE_TYPE_KEYBOARD, ev->id, + device->keyboard, ee); evas_device_del(device->keyboard); device->keyboard = NULL; @@ -1242,7 +1244,7 @@ _ecore_evas_wl_common_cb_seat_capabilities_changed(void *d EINA_UNUSED, int t EI _ecore_evas_wl_common_device_event_add (ECORE_WL2_EVENT_DEVICE_REMOVED, ECORE_WL2_DEVICE_TYPE_TOUCH, - ev->id, NULL, ee); + ev->id, device->touch, ee); evas_device_del(device->touch); device->touch = NULL;