diff --git a/src/lib/evas/canvas/evas_callbacks.c b/src/lib/evas/canvas/evas_callbacks.c index faf84455e6..fac0a0c8ea 100644 --- a/src/lib/evas/canvas/evas_callbacks.c +++ b/src/lib/evas/canvas/evas_callbacks.c @@ -173,6 +173,7 @@ static void evas_object_event_callback_clear(Evas_Object *eo_obj) { Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); + if (!obj) return; if (!obj->callbacks) return; if (!obj->callbacks->deletions_waiting) return; obj->callbacks->deletions_waiting = 0; @@ -188,6 +189,7 @@ static void evas_event_callback_clear(Evas *eo_e) { Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); + if (!e) return; if (!e->callbacks) return; if (!e->callbacks->deletions_waiting) return; e->callbacks->deletions_waiting = 0; @@ -205,6 +207,7 @@ evas_object_event_callback_all_del(Evas_Object *eo_obj) Evas_Func_Node *fn; Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); + if (!obj) return; if (!obj->callbacks) return; EINA_INLIST_FOREACH(obj->callbacks->callbacks, fn) fn->delete_me = 1; @@ -215,6 +218,7 @@ evas_object_event_callback_cleanup(Evas_Object *eo_obj) { /* MEM OK */ Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); + if (!obj) return; if (!obj->callbacks) return; evas_event_callback_list_post_free(&obj->callbacks->callbacks); EVAS_MEMPOOL_FREE(_mp_cb, obj->callbacks); @@ -227,6 +231,7 @@ evas_event_callback_all_del(Evas *eo_e) Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); Evas_Func_Node *fn; + if (!e) return; if (!e->callbacks) return; EINA_INLIST_FOREACH(e->callbacks->callbacks, fn) fn->delete_me = 1; @@ -237,6 +242,7 @@ evas_event_callback_cleanup(Evas *eo_e) { Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); /* MEM OK */ + if (!e) return; if (!e->callbacks) return; evas_event_callback_list_post_free(&e->callbacks->callbacks); EVAS_MEMPOOL_FREE(_mp_cb, e->callbacks); @@ -249,6 +255,7 @@ evas_event_callback_call(Evas *eo_e, Evas_Callback_Type type, void *event_info) Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); Eina_Inlist **l_mod = NULL, *l; + if (!e) return; _evas_walk(e); if (e->callbacks) { @@ -285,6 +292,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data Evas_Button_Flags flags = EVAS_BUTTON_NONE; Evas_Public_Data *e; + if (!obj) return; if ((obj->delete_me) || (!obj->layer)) return; if ((obj->last_event == event_id) && (obj->last_event_type == type)) return; @@ -418,6 +426,7 @@ evas_object_event_callback_priority_add(Evas_Object *eo_obj, Evas_Callback_Type return; MAGIC_CHECK_END(); + if (!obj) return; if (!func) return; if (!obj->callbacks) @@ -453,6 +462,7 @@ evas_object_event_callback_del(Evas_Object *eo_obj, Evas_Callback_Type type, Eva MAGIC_CHECK_END(); Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); + if (!obj) return NULL; if (!func) return NULL; if (!obj->callbacks) return NULL; @@ -485,6 +495,7 @@ evas_object_event_callback_del_full(Evas_Object *eo_obj, Evas_Callback_Type type MAGIC_CHECK_END(); Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); + if (!obj) return NULL; if (!func) return NULL; if (!obj->callbacks) return NULL; @@ -524,6 +535,7 @@ evas_event_callback_priority_add(Evas *eo_e, Evas_Callback_Type type, Evas_Callb return; MAGIC_CHECK_END(); + if (!e) return; if (!func) return; if (!e->callbacks) @@ -558,6 +570,7 @@ evas_event_callback_del(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func) return NULL; MAGIC_CHECK_END(); + if (!e) return NULL; if (!func) return NULL; if (!e->callbacks) return NULL; @@ -590,6 +603,7 @@ evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb MAGIC_CHECK_END(); Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); + if (!e) return NULL; if (!func) return NULL; if (!e->callbacks) return NULL; @@ -621,6 +635,7 @@ evas_post_event_callback_push(Evas *eo_e, Evas_Object_Event_Post_Cb func, const MAGIC_CHECK_END(); Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); + if (!e) return; EVAS_MEMPOOL_INIT(_mp_pc, "evas_post_callback", Evas_Post_Callback, 64, ); pc = EVAS_MEMPOOL_ALLOC(_mp_pc, Evas_Post_Callback); if (!pc) return; @@ -643,6 +658,7 @@ evas_post_event_callback_remove(Evas *eo_e, Evas_Object_Event_Post_Cb func) MAGIC_CHECK_END(); Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); + if (!e) return; EINA_LIST_FOREACH(e->post_events, l, pc) { if (pc->func == func) @@ -664,6 +680,7 @@ evas_post_event_callback_remove_full(Evas *eo_e, Evas_Object_Event_Post_Cb func, MAGIC_CHECK_END(); Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); + if (!e) return; EINA_LIST_FOREACH(e->post_events, l, pc) { if ((pc->func == func) && (pc->data == data)) diff --git a/src/lib/evas/canvas/evas_layer.c b/src/lib/evas/canvas/evas_layer.c index fa86aa9334..ef13547572 100644 --- a/src/lib/evas/canvas/evas_layer.c +++ b/src/lib/evas/canvas/evas_layer.c @@ -8,6 +8,8 @@ evas_object_inject(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data * { Evas_Layer *lay; + if (!obj) return; + if (!e) return; if (obj->in_layer) return; lay = evas_layer_find(e, obj->cur.layer); if (!lay) diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index c8b972c03c..6a9bce835f 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -97,9 +97,12 @@ evas_object_free(Evas_Object *eo_obj, int clean_layer) if (obj->cache_map) evas_map_free(obj->cache_map); if (obj->map.surface) { - obj->layer->evas->engine.func->image_map_surface_free - (obj->layer->evas->engine.data.output, - obj->map.surface); + if (obj->layer) + { + obj->layer->evas->engine.func->image_map_surface_free + (obj->layer->evas->engine.data.output, + obj->map.surface); + } obj->map.surface = NULL; } evas_object_grabs_cleanup(eo_obj, obj); @@ -143,6 +146,7 @@ evas_object_change(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) Evas_Object *eo_obj2; Eina_Bool movch = EINA_FALSE; + if (!obj->layer) return; if (obj->layer->evas->nochange) return; obj->layer->evas->changed = EINA_TRUE; @@ -320,6 +324,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in int x, y, w, h; if (!obj) return; + if (!obj->layer) return; if (obj->is_smart) goto end; /* FIXME: was_v isn't used... why? */ @@ -528,17 +533,20 @@ _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) if (obj->focused) { obj->focused = EINA_FALSE; - obj->layer->evas->focused = NULL; + if (obj->layer) + obj->layer->evas->focused = NULL; _evas_object_event_new(); evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter); - _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); + if (obj->layer) + _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); } _evas_object_event_new(); evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter); - _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); - if (obj->mouse_grabbed > 0) + if (obj->layer) + _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); + if ((obj->mouse_grabbed > 0) && (obj->layer)) obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; - if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) + if (((obj->mouse_in) || (obj->mouse_grabbed > 0)) && (obj->layer)) obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, eo_obj); obj->mouse_grabbed = 0; obj->mouse_in = 0; @@ -559,7 +567,8 @@ _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) if (obj->is_smart) evas_object_smart_del(eo_obj); _evas_object_event_new(); evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter); - _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); + if (obj->layer) + _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); evas_object_smart_cleanup(eo_obj); obj->delete_me = 1; evas_object_change(eo_obj, obj); @@ -713,7 +722,8 @@ _position_set(Eo *eo_obj, void *_pd, va_list *list) int nx = 0, ny = 0; if (obj->delete_me) return; - + if (!obj->layer) return; + nx = x; ny = y; @@ -808,6 +818,7 @@ _size_set(Eo *eo_obj, void *_pd, va_list *list) Eina_Bool source_invisible = EINA_FALSE; if (obj->delete_me) return; + if (!obj->layer) return; if (w < 0) w = 0; if (h < 0) h = 0; if (evas_object_intercept_call_resize(eo_obj, w, h)) return; @@ -893,7 +904,7 @@ _position_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) Evas_Coord *x = va_arg(*list, Evas_Coord *); Evas_Coord *y = va_arg(*list, Evas_Coord *); - if (obj->delete_me) + if ((obj->delete_me) || (!obj->layer)) { if (x) *x = 0; if (y) *y = 0; return; @@ -1400,8 +1411,9 @@ _visible_set(Eo *eo_obj, void *_pd, va_list *list) } static void -_show (Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) +_show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) { + if (!obj->layer) return; if (obj->delete_me) return; if (evas_object_intercept_call_show(eo_obj)) return; if (obj->is_smart) @@ -1445,6 +1457,7 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); return; MAGIC_CHECK_END(); + if (!obj->layer) return; if (obj->delete_me) return; if (evas_object_intercept_call_hide(eo_obj)) return; if (obj->is_smart) @@ -1805,7 +1818,7 @@ _evas_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) const Evas_Object_Protected_Data *obj = _pd; Evas **evas = va_arg(*list, Evas **); - if (obj->delete_me) + if ((obj->delete_me) || (!obj->layer)) { *evas = NULL; return;