diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-11-09 11:38:35 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-11-09 11:42:29 +0900 |
commit | 1e83d963d905447588a91e1beafd382631d447bd (patch) | |
tree | da1ca0d8bb121927e261a0c8f167723de16084c8 | |
parent | 6c444bebcbb8858364c88f9aba4b217b23b28a07 (diff) | |
download | efl-1e83d963d905447588a91e1beafd382631d447bd.tar.gz |
elput - ref device that is in the event queue
-rw-r--r-- | src/lib/elput/elput_evdev.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c index afa42df68c..b41fbe508b 100644 --- a/src/lib/elput/elput_evdev.c +++ b/src/lib/elput/elput_evdev.c @@ -1596,6 +1596,15 @@ _tablet_tool_tip(struct libinput_device *idev, struct libinput_event_tablet_tool } static void +_switch_event_free(void *data EINA_UNUSED, void *event) +{ + Elput_Event_Switch *ev = event; + + _evdev_device_destroy(ev->device); + free(ev); +} + +static void _switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event) { Elput_Event_Switch *ev; @@ -1603,10 +1612,11 @@ _switch_toggle(struct libinput_device *idev, struct libinput_event_switch *event ev = calloc(1, sizeof(Elput_Event_Switch)); if (!ev) return; ev->device = libinput_device_get_user_data(idev); + ev->device->refs++; ev->time_usec = libinput_event_switch_get_time_usec(event); ev->type = (Elput_Switch_Type)libinput_event_switch_get_switch(event); ev->state = (Elput_Switch_State)libinput_event_switch_get_switch_state(event); - ecore_event_add(ELPUT_EVENT_SWITCH, ev, NULL, NULL); + ecore_event_add(ELPUT_EVENT_SWITCH, ev, _switch_event_free, NULL); } int |