summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2018-01-17 09:22:13 +0900
committerThiep Ha <thiepha@gmail.com>2018-01-17 09:25:57 +0900
commite625c9b8307175f68725abf067518670b36a3263 (patch)
treebfb0c999596fe6b885cfd98a83777b211ae5cfd4
parent17b0db9ed39e6a203c93a5b44760c7eb72087186 (diff)
selection: delete callbacks when the manager is deleted
If the selection manager is deleted before the drop objects are deleted, we need to remove callbacks in its destructor. Thank @herdsman for reporting this.
-rw-r--r--src/lib/elementary/efl_selection_manager.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_selection_manager.c b/src/lib/elementary/efl_selection_manager.c
index 1acd8c2af8..6405ea3923 100644
--- a/src/lib/elementary/efl_selection_manager.c
+++ b/src/lib/elementary/efl_selection_manager.c
@@ -282,21 +282,17 @@ _tmpinfo_free(Tmp_Info *info)
282 return 0; 282 return 0;
283} 283}
284 284
285static void 285static inline void
286_all_drop_targets_cbs_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED) 286_drop_target_cbs_del(Efl_Selection_Manager_Data *pd, Sel_Manager_Dropable *dropable, Efl_Object *obj)
287{ 287{
288 Efl_Selection_Manager_Data *pd = data;
289 Sel_Manager_Dropable *dropable = NULL;
290
291 if (!pd) return;
292 dropable = efl_key_data_get(obj, "__elm_dropable");
293 if (dropable) 288 if (dropable)
294 { 289 {
295 Drop_Format *df; 290 Drop_Format *df;
296 while (dropable->format_list) 291 while (dropable->format_list)
297 { 292 {
298 df = EINA_INLIST_CONTAINER_GET(dropable->format_list, Drop_Format); 293 df = EINA_INLIST_CONTAINER_GET(dropable->format_list, Drop_Format);
299 efl_selection_manager_drop_target_del(pd->sel_man, obj, df->format, dropable->seat); 294 efl_selection_manager_drop_target_del(pd->sel_man, obj,
295 df->format, dropable->seat);
300 // If drop_target_del() happened to delete dropabale, then 296 // If drop_target_del() happened to delete dropabale, then
301 // re-fetch it each loop to make sure it didn't 297 // re-fetch it each loop to make sure it didn't
302 dropable = efl_key_data_get(obj, "__elm_dropable"); 298 dropable = efl_key_data_get(obj, "__elm_dropable");
@@ -306,6 +302,17 @@ _all_drop_targets_cbs_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, voi
306} 302}
307 303
308static void 304static void
305_all_drop_targets_cbs_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED)
306{
307 Efl_Selection_Manager_Data *pd = data;
308 Sel_Manager_Dropable *dropable = NULL;
309
310 if (!pd) return;
311 dropable = efl_key_data_get(obj, "__elm_dropable");
312 _drop_target_cbs_del(pd, dropable, obj);
313}
314
315static void
309_dropable_coords_adjust(Sel_Manager_Dropable *dropable, Eina_Position2D *pos) 316_dropable_coords_adjust(Sel_Manager_Dropable *dropable, Eina_Position2D *pos)
310{ 317{
311 Ecore_Evas *ee; 318 Ecore_Evas *ee;
@@ -370,7 +377,7 @@ _drag_cancel_animate(void *data, double pos)
370 Ecore_X_Window xdragwin = _x11_xwin_get(seat_sel->drag_win); 377 Ecore_X_Window xdragwin = _x11_xwin_get(seat_sel->drag_win);
371 ecore_x_window_ignore_set(xdragwin, 0); 378 ecore_x_window_ignore_set(xdragwin, 0);
372#endif 379#endif
373 ERR("Delete drag_win"); 380 sel_debug("Delete drag_win");
374 evas_object_del(seat_sel->drag_win); 381 evas_object_del(seat_sel->drag_win);
375 seat_sel->drag_win = NULL; 382 seat_sel->drag_win = NULL;
376 return ECORE_CALLBACK_CANCEL; 383 return ECORE_CALLBACK_CANCEL;
@@ -5214,7 +5221,13 @@ static void
5214_efl_selection_manager_efl_object_destructor(Eo *obj, Efl_Selection_Manager_Data *pd) 5221_efl_selection_manager_efl_object_destructor(Eo *obj, Efl_Selection_Manager_Data *pd)
5215{ 5222{
5216 Sel_Manager_Seat_Selection *seat_sel; 5223 Sel_Manager_Seat_Selection *seat_sel;
5224 Eina_List *l;
5225 Sel_Manager_Dropable *dropable;
5217 5226
5227 EINA_LIST_FOREACH(pd->drop_list, l, dropable)
5228 {
5229 _drop_target_cbs_del(pd, dropable, dropable->obj);
5230 }
5218#ifdef HAVE_ELEMENTARY_X 5231#ifdef HAVE_ELEMENTARY_X
5219 ecore_event_handler_del(pd->notify_handler); 5232 ecore_event_handler_del(pd->notify_handler);
5220 ecore_event_handler_del(pd->clear_handler); 5233 ecore_event_handler_del(pd->clear_handler);