bdilly pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1e62cd562ee2f35e867e59f640e5ee5f2a7e0f29

commit 1e62cd562ee2f35e867e59f640e5ee5f2a7e0f29
Author: Bruno Dilly <[email protected]>
Date:   Thu Nov 24 18:26:50 2016 -0200

    ecore_wl2: avoid adding repeated devices
    
    Summary:
    After changes done on commit 9f8e2e0d9c9b4150
    it was possible to have multiple devices with the same
    id added throught the function
    _ecore_evas_wl_common_cb_global_added().
    
    To avoid such issue, let's check if the device was already
    created first.
    
    Reviewers: iscaro
    
    Subscribers: cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D4428
---
 .../engines/wayland/ecore_evas_wayland_common.c        | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

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 2053c21..232d96b 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
@@ -555,13 +555,29 @@ _ecore_evas_wl_common_cb_global_added(void *d 
EINA_UNUSED, int t EINA_UNUSED, vo
 {
    Ecore_Wl2_Event_Global *ev = event;
    Ecore_Evas *ee;
-   Eina_List *l;
+   Eina_List *l, *ll;
+   EE_Wl_Device *device;
 
    if ((!ev->interface) || (strcmp(ev->interface, "wl_seat")))
        return ECORE_CALLBACK_PASS_ON;
 
    EINA_LIST_FOREACH(ee_list, l, ee)
      {
+        Eina_Bool already_present = EINA_FALSE;
+        Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
+
+        EINA_LIST_FOREACH(wdata->devices_list, ll, device)
+          {
+             if (device->id == ev->id)
+               {
+                  already_present = EINA_TRUE;
+                  break;
+               }
+          }
+
+        if (already_present)
+          continue;
+
         if (!_ecore_evas_wl_common_seat_add(ee, ev->id))
           break;
      }

-- 


Reply via email to