Selection manager: properly clean in drop_target_del
authorDaniel Hirt <hirt.danny@gmail.com>
Thu, 12 Jul 2018 15:16:03 +0000 (18:16 +0300)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 24 Jul 2018 05:37:19 +0000 (14:37 +0900)
Summary:
The last lines in _efl_selection_manager_drop_target_del were skipped
when `!pd->drop_list` was met. These lines clear the selection event
handlers. Thus, events kept firing and causing erratic behavior.

Fixes T7130

Subscribers: cedric, #committers, zmike

Tags: #efl

Maniphest Tasks: T7130

Differential Revision: https://phab.enlightenment.org/D6579

src/lib/elementary/efl_selection_manager.c

index 926ba04..c603c08 100644 (file)
@@ -5036,22 +5036,24 @@ _efl_selection_manager_drop_target_del(Eo *obj EINA_UNUSED, Efl_Selection_Manage
           }
      }
 
-   if (!pd->drop_list) return;
 #ifdef HAVE_ELEMENTARY_X
-   Eina_List *l;
-   Ecore_X_Window xwin;
-   Eina_Bool have_drop_list = EINA_FALSE;
-
-   xwin = _x11_xwin_get(target_obj);
-   EINA_LIST_FOREACH(pd->drop_list, l, dropable)
+   if (pd->drop_list)
      {
-        if (xwin == _x11_xwin_get(dropable->obj))
+        Eina_List *l;
+        Ecore_X_Window xwin;
+        Eina_Bool have_drop_list = EINA_FALSE;
+
+        xwin = _x11_xwin_get(target_obj);
+        EINA_LIST_FOREACH(pd->drop_list, l, dropable)
           {
-             have_drop_list = EINA_TRUE;
-             break;
+             if (xwin == _x11_xwin_get(dropable->obj))
+               {
+                  have_drop_list = EINA_TRUE;
+                  break;
+               }
           }
+        if (!have_drop_list) ecore_x_dnd_aware_set(xwin, EINA_FALSE);
      }
-   if (!have_drop_list) ecore_x_dnd_aware_set(xwin, EINA_FALSE);
 #endif
    seat_sel = _sel_manager_seat_selection_init(pd, seat);
    ELM_SAFE_FREE(seat_sel->pos_handler, ecore_event_handler_del);