From: Inhong Han Date: Mon, 30 Oct 2023 07:46:01 +0000 (+0900) Subject: e_input: Add missing unref of input device X-Git-Tag: accepted/tizen/unified/20231102.175749~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=496237dcb423391149fdc40141202d616ae5a54c;p=platform%2Fupstream%2Fenlightenment.git e_input: Add missing unref of input device Change-Id: Ic383a5cff3c3e518031289599b3119a313fe1a27 --- diff --git a/src/bin/e_input_inputs.c b/src/bin/e_input_inputs.c index 8e1243d949..ffa7646fe7 100644 --- a/src/bin/e_input_inputs.c +++ b/src/bin/e_input_inputs.c @@ -324,10 +324,13 @@ _e_input_add_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas) static Eina_Bool _e_input_remove_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas) { + Eina_Bool ret = EINA_FALSE; const Eina_List *dev_list = NULL, *l; + const GList *e_dev_list = NULL; Eina_List *ll, *ll_next; Ecore_Device *dev = NULL, *data; const char *identifier; + const gchar *device_identifier; if (!edev->path) return EINA_FALSE; @@ -359,11 +362,45 @@ _e_input_remove_ecore_device(E_Input_Evdev *edev, Ecore_Device_Class clas) } _e_input_ecore_device_event(dev, edev->seat ? edev->seat->name : NULL, EINA_FALSE); ecore_device_del(dev); - return EINA_TRUE; + ret = EINA_TRUE; } } - return EINA_FALSE; + e_dev_list = e_device_list_get(); + if (!e_dev_list) + { + ERR("Failed to get e device list"); + return EINA_FALSE; + } + + for (GList *list = g_list_first((GList *)e_dev_list); list; list = list->next) + { + E_Device *device = (E_Device *)list->data; + if (!device) continue; + device_identifier = e_device_identifier_get(device); + if (!device_identifier) continue; + + if ((e_device_class_get(device) == clas) && (!strcmp(device_identifier, edev->path))) + { + if (edev->e_dev) + { + g_object_unref(device); + edev->e_dev = NULL; + } + else if (edev->e_dev_list) + { + GList *del_list = g_list_find(edev->e_dev_list, device); + if (del_list) + { + g_object_unref(device); + edev->e_dev_list = g_list_delete_link(edev->e_dev_list, del_list); + } + } + ret = EINA_TRUE; + } + } + + return ret; } Eina_Bool