summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-06-20 12:08:14 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-06-20 12:08:14 +0100
commit33f5e53af3cf059b234f4e618f573ac6b354f7c6 (patch)
treecfd9bf433f41324713ea6ae60b15faa7932e11a9
parent471c4bebb592bc11f7acc001166075a8721ebb0b (diff)
evas - events - protect on object deletion while calling callbacks
mouse in/out feeds can call callabcks that can then go delete objects - ref them all to ensure they stay alive while we use them. this will fix a segv apbbb saw.
-rw-r--r--src/lib/evas/canvas/evas_events.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_events.c b/src/lib/evas/canvas/evas_events.c
index ee31ef5ac2..9dfa24ca39 100644
--- a/src/lib/evas/canvas/evas_events.c
+++ b/src/lib/evas/canvas/evas_events.c
@@ -2610,6 +2610,7 @@ _canvas_event_feed_mouse_in_internal(Evas *eo_e, Efl_Input_Pointer_Data *ev)
2610 { 2610 {
2611 Evas_Object_Pointer_Data *obj_pdata; 2611 Evas_Object_Pointer_Data *obj_pdata;
2612 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 2612 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
2613 if ((!obj) || (obj->delete_me)) continue;
2613 if (!eina_list_data_find(pdata->seat->object.in, eo_obj)) 2614 if (!eina_list_data_find(pdata->seat->object.in, eo_obj))
2614 { 2615 {
2615 obj_pdata = _evas_object_pointer_data_get(pdata, obj); 2616 obj_pdata = _evas_object_pointer_data_get(pdata, obj);
@@ -2625,6 +2626,7 @@ _canvas_event_feed_mouse_in_internal(Evas *eo_e, Efl_Input_Pointer_Data *ev)
2625 ev->cur.y = pdata->seat->y; 2626 ev->cur.y = pdata->seat->y;
2626 _evas_event_havemap_adjust_f(eo_obj, obj, &ev->cur, obj_pdata->mouse_grabbed); 2627 _evas_event_havemap_adjust_f(eo_obj, obj, &ev->cur, obj_pdata->mouse_grabbed);
2627 ev->action = EFL_POINTER_ACTION_IN; 2628 ev->action = EFL_POINTER_ACTION_IN;
2629 efl_ref(eo_obj);
2628 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_IN, evt, 2630 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_IN, evt,
2629 event_id, EFL_EVENT_POINTER_IN); 2631 event_id, EFL_EVENT_POINTER_IN);
2630 if ((pdata->seat->x != ev->prev.x) && 2632 if ((pdata->seat->x != ev->prev.x) &&
@@ -2636,6 +2638,7 @@ _canvas_event_feed_mouse_in_internal(Evas *eo_e, Efl_Input_Pointer_Data *ev)
2636 } 2638 }
2637 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 2639 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
2638 _evas_event_source_mouse_in_events(eo_obj, eo_e, evt, event_id); 2640 _evas_event_source_mouse_in_events(eo_obj, eo_e, evt, event_id);
2641 efl_unref(eo_obj);
2639 if (e->delete_me || e->is_frozen) break; 2642 if (e->delete_me || e->is_frozen) break;
2640 } 2643 }
2641 } 2644 }
@@ -2708,7 +2711,7 @@ _canvas_event_feed_mouse_out_internal(Evas *eo_e, Efl_Input_Pointer_Data *ev)
2708 { 2711 {
2709 Evas_Object_Pointer_Data *obj_pdata; 2712 Evas_Object_Pointer_Data *obj_pdata;
2710 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 2713 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
2711 if (obj->delete_me) continue; 2714 if ((!obj) || (obj->delete_me)) continue;
2712 obj_pdata = _evas_object_pointer_data_get(pdata, obj); 2715 obj_pdata = _evas_object_pointer_data_get(pdata, obj);
2713 if (!obj_pdata) 2716 if (!obj_pdata)
2714 { 2717 {
@@ -2720,11 +2723,13 @@ _canvas_event_feed_mouse_out_internal(Evas *eo_e, Efl_Input_Pointer_Data *ev)
2720 _evas_event_mouse_in_set(pdata->seat, obj, 0); 2723 _evas_event_mouse_in_set(pdata->seat, obj, 0);
2721 ev->cur.x = pdata->seat->x; 2724 ev->cur.x = pdata->seat->x;
2722 ev->cur.y = pdata->seat->y; 2725 ev->cur.y = pdata->seat->y;
2726 efl_ref(eo_obj);
2723 _evas_event_havemap_adjust_f(eo_obj, obj, &ev->cur, obj_pdata->mouse_grabbed); 2727 _evas_event_havemap_adjust_f(eo_obj, obj, &ev->cur, obj_pdata->mouse_grabbed);
2724 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_OUT, evt, 2728 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_MOUSE_OUT, evt,
2725 event_id, EFL_EVENT_POINTER_OUT); 2729 event_id, EFL_EVENT_POINTER_OUT);
2726 if ((obj->proxy->is_proxy) && (obj->proxy->src_events)) 2730 if ((obj->proxy->is_proxy) && (obj->proxy->src_events))
2727 _evas_event_source_mouse_out_events(eo_obj, eo_e, evt, event_id); 2731 _evas_event_source_mouse_out_events(eo_obj, eo_e, evt, event_id);
2732 efl_unref(eo_obj);
2728 if (e->delete_me || e->is_frozen) break; 2733 if (e->delete_me || e->is_frozen) break;
2729 obj_pdata->mouse_grabbed = 0; 2734 obj_pdata->mouse_grabbed = 0;
2730 } 2735 }