summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-11-12 02:22:39 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-11-12 02:22:39 +0000
commit0bbec07e6960fb568fdb60b10b0e1eab4cf63d00 (patch)
treeb9d8cdf380d7f2c5dd16c913d17673aaecf549df
parentee63a9e294c1eeaba1999c0fe33f25b34c5a09bd (diff)
protect against a whole bunch of NULLS that the new eo stuff brings out.
SVN revision: 79129
-rw-r--r--src/lib/evas/canvas/evas_callbacks.c17
-rw-r--r--src/lib/evas/canvas/evas_layer.c2
-rw-r--r--src/lib/evas/canvas/evas_object_main.c39
3 files changed, 45 insertions, 13 deletions
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
173evas_object_event_callback_clear(Evas_Object *eo_obj) 173evas_object_event_callback_clear(Evas_Object *eo_obj)
174{ 174{
175 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 175 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
176 if (!obj) return;
176 if (!obj->callbacks) return; 177 if (!obj->callbacks) return;
177 if (!obj->callbacks->deletions_waiting) return; 178 if (!obj->callbacks->deletions_waiting) return;
178 obj->callbacks->deletions_waiting = 0; 179 obj->callbacks->deletions_waiting = 0;
@@ -188,6 +189,7 @@ static void
188evas_event_callback_clear(Evas *eo_e) 189evas_event_callback_clear(Evas *eo_e)
189{ 190{
190 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 191 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
192 if (!e) return;
191 if (!e->callbacks) return; 193 if (!e->callbacks) return;
192 if (!e->callbacks->deletions_waiting) return; 194 if (!e->callbacks->deletions_waiting) return;
193 e->callbacks->deletions_waiting = 0; 195 e->callbacks->deletions_waiting = 0;
@@ -205,6 +207,7 @@ evas_object_event_callback_all_del(Evas_Object *eo_obj)
205 Evas_Func_Node *fn; 207 Evas_Func_Node *fn;
206 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 208 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
207 209
210 if (!obj) return;
208 if (!obj->callbacks) return; 211 if (!obj->callbacks) return;
209 EINA_INLIST_FOREACH(obj->callbacks->callbacks, fn) 212 EINA_INLIST_FOREACH(obj->callbacks->callbacks, fn)
210 fn->delete_me = 1; 213 fn->delete_me = 1;
@@ -215,6 +218,7 @@ evas_object_event_callback_cleanup(Evas_Object *eo_obj)
215{ 218{
216 /* MEM OK */ 219 /* MEM OK */
217 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 220 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
221 if (!obj) return;
218 if (!obj->callbacks) return; 222 if (!obj->callbacks) return;
219 evas_event_callback_list_post_free(&obj->callbacks->callbacks); 223 evas_event_callback_list_post_free(&obj->callbacks->callbacks);
220 EVAS_MEMPOOL_FREE(_mp_cb, obj->callbacks); 224 EVAS_MEMPOOL_FREE(_mp_cb, obj->callbacks);
@@ -227,6 +231,7 @@ evas_event_callback_all_del(Evas *eo_e)
227 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 231 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
228 Evas_Func_Node *fn; 232 Evas_Func_Node *fn;
229 233
234 if (!e) return;
230 if (!e->callbacks) return; 235 if (!e->callbacks) return;
231 EINA_INLIST_FOREACH(e->callbacks->callbacks, fn) 236 EINA_INLIST_FOREACH(e->callbacks->callbacks, fn)
232 fn->delete_me = 1; 237 fn->delete_me = 1;
@@ -237,6 +242,7 @@ evas_event_callback_cleanup(Evas *eo_e)
237{ 242{
238 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 243 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
239 /* MEM OK */ 244 /* MEM OK */
245 if (!e) return;
240 if (!e->callbacks) return; 246 if (!e->callbacks) return;
241 evas_event_callback_list_post_free(&e->callbacks->callbacks); 247 evas_event_callback_list_post_free(&e->callbacks->callbacks);
242 EVAS_MEMPOOL_FREE(_mp_cb, e->callbacks); 248 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)
249 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 255 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
250 Eina_Inlist **l_mod = NULL, *l; 256 Eina_Inlist **l_mod = NULL, *l;
251 257
258 if (!e) return;
252 _evas_walk(e); 259 _evas_walk(e);
253 if (e->callbacks) 260 if (e->callbacks)
254 { 261 {
@@ -285,6 +292,7 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
285 Evas_Button_Flags flags = EVAS_BUTTON_NONE; 292 Evas_Button_Flags flags = EVAS_BUTTON_NONE;
286 Evas_Public_Data *e; 293 Evas_Public_Data *e;
287 294
295 if (!obj) return;
288 if ((obj->delete_me) || (!obj->layer)) return; 296 if ((obj->delete_me) || (!obj->layer)) return;
289 if ((obj->last_event == event_id) && 297 if ((obj->last_event == event_id) &&
290 (obj->last_event_type == type)) return; 298 (obj->last_event_type == type)) return;
@@ -418,6 +426,7 @@ evas_object_event_callback_priority_add(Evas_Object *eo_obj, Evas_Callback_Type
418 return; 426 return;
419 MAGIC_CHECK_END(); 427 MAGIC_CHECK_END();
420 428
429 if (!obj) return;
421 if (!func) return; 430 if (!func) return;
422 431
423 if (!obj->callbacks) 432 if (!obj->callbacks)
@@ -453,6 +462,7 @@ evas_object_event_callback_del(Evas_Object *eo_obj, Evas_Callback_Type type, Eva
453 MAGIC_CHECK_END(); 462 MAGIC_CHECK_END();
454 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 463 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
455 464
465 if (!obj) return NULL;
456 if (!func) return NULL; 466 if (!func) return NULL;
457 467
458 if (!obj->callbacks) return NULL; 468 if (!obj->callbacks) return NULL;
@@ -485,6 +495,7 @@ evas_object_event_callback_del_full(Evas_Object *eo_obj, Evas_Callback_Type type
485 MAGIC_CHECK_END(); 495 MAGIC_CHECK_END();
486 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 496 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
487 497
498 if (!obj) return NULL;
488 if (!func) return NULL; 499 if (!func) return NULL;
489 500
490 if (!obj->callbacks) return NULL; 501 if (!obj->callbacks) return NULL;
@@ -524,6 +535,7 @@ evas_event_callback_priority_add(Evas *eo_e, Evas_Callback_Type type, Evas_Callb
524 return; 535 return;
525 MAGIC_CHECK_END(); 536 MAGIC_CHECK_END();
526 537
538 if (!e) return;
527 if (!func) return; 539 if (!func) return;
528 540
529 if (!e->callbacks) 541 if (!e->callbacks)
@@ -558,6 +570,7 @@ evas_event_callback_del(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func)
558 return NULL; 570 return NULL;
559 MAGIC_CHECK_END(); 571 MAGIC_CHECK_END();
560 572
573 if (!e) return NULL;
561 if (!func) return NULL; 574 if (!func) return NULL;
562 575
563 if (!e->callbacks) return NULL; 576 if (!e->callbacks) return NULL;
@@ -590,6 +603,7 @@ evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb
590 MAGIC_CHECK_END(); 603 MAGIC_CHECK_END();
591 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 604 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
592 605
606 if (!e) return NULL;
593 if (!func) return NULL; 607 if (!func) return NULL;
594 608
595 if (!e->callbacks) return NULL; 609 if (!e->callbacks) return NULL;
@@ -621,6 +635,7 @@ evas_post_event_callback_push(Evas *eo_e, Evas_Object_Event_Post_Cb func, const
621 MAGIC_CHECK_END(); 635 MAGIC_CHECK_END();
622 636
623 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 637 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
638 if (!e) return;
624 EVAS_MEMPOOL_INIT(_mp_pc, "evas_post_callback", Evas_Post_Callback, 64, ); 639 EVAS_MEMPOOL_INIT(_mp_pc, "evas_post_callback", Evas_Post_Callback, 64, );
625 pc = EVAS_MEMPOOL_ALLOC(_mp_pc, Evas_Post_Callback); 640 pc = EVAS_MEMPOOL_ALLOC(_mp_pc, Evas_Post_Callback);
626 if (!pc) return; 641 if (!pc) return;
@@ -643,6 +658,7 @@ evas_post_event_callback_remove(Evas *eo_e, Evas_Object_Event_Post_Cb func)
643 MAGIC_CHECK_END(); 658 MAGIC_CHECK_END();
644 659
645 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 660 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
661 if (!e) return;
646 EINA_LIST_FOREACH(e->post_events, l, pc) 662 EINA_LIST_FOREACH(e->post_events, l, pc)
647 { 663 {
648 if (pc->func == func) 664 if (pc->func == func)
@@ -664,6 +680,7 @@ evas_post_event_callback_remove_full(Evas *eo_e, Evas_Object_Event_Post_Cb func,
664 MAGIC_CHECK_END(); 680 MAGIC_CHECK_END();
665 681
666 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS); 682 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
683 if (!e) return;
667 EINA_LIST_FOREACH(e->post_events, l, pc) 684 EINA_LIST_FOREACH(e->post_events, l, pc)
668 { 685 {
669 if ((pc->func == func) && (pc->data == data)) 686 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 *
8{ 8{
9 Evas_Layer *lay; 9 Evas_Layer *lay;
10 10
11 if (!obj) return;
12 if (!e) return;
11 if (obj->in_layer) return; 13 if (obj->in_layer) return;
12 lay = evas_layer_find(e, obj->cur.layer); 14 lay = evas_layer_find(e, obj->cur.layer);
13 if (!lay) 15 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)
97 if (obj->cache_map) evas_map_free(obj->cache_map); 97 if (obj->cache_map) evas_map_free(obj->cache_map);
98 if (obj->map.surface) 98 if (obj->map.surface)
99 { 99 {
100 obj->layer->evas->engine.func->image_map_surface_free 100 if (obj->layer)
101 (obj->layer->evas->engine.data.output, 101 {
102 obj->map.surface); 102 obj->layer->evas->engine.func->image_map_surface_free
103 (obj->layer->evas->engine.data.output,
104 obj->map.surface);
105 }
103 obj->map.surface = NULL; 106 obj->map.surface = NULL;
104 } 107 }
105 evas_object_grabs_cleanup(eo_obj, obj); 108 evas_object_grabs_cleanup(eo_obj, obj);
@@ -143,6 +146,7 @@ evas_object_change(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
143 Evas_Object *eo_obj2; 146 Evas_Object *eo_obj2;
144 Eina_Bool movch = EINA_FALSE; 147 Eina_Bool movch = EINA_FALSE;
145 148
149 if (!obj->layer) return;
146 if (obj->layer->evas->nochange) return; 150 if (obj->layer->evas->nochange) return;
147 obj->layer->evas->changed = EINA_TRUE; 151 obj->layer->evas->changed = EINA_TRUE;
148 152
@@ -320,6 +324,7 @@ evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *eo_obj, in
320 int x, y, w, h; 324 int x, y, w, h;
321 325
322 if (!obj) return; 326 if (!obj) return;
327 if (!obj->layer) return;
323 328
324 if (obj->is_smart) goto end; 329 if (obj->is_smart) goto end;
325 /* FIXME: was_v isn't used... why? */ 330 /* FIXME: was_v isn't used... why? */
@@ -528,17 +533,20 @@ _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
528 if (obj->focused) 533 if (obj->focused)
529 { 534 {
530 obj->focused = EINA_FALSE; 535 obj->focused = EINA_FALSE;
531 obj->layer->evas->focused = NULL; 536 if (obj->layer)
537 obj->layer->evas->focused = NULL;
532 _evas_object_event_new(); 538 _evas_object_event_new();
533 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter); 539 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter);
534 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); 540 if (obj->layer)
541 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
535 } 542 }
536 _evas_object_event_new(); 543 _evas_object_event_new();
537 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter); 544 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter);
538 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); 545 if (obj->layer)
539 if (obj->mouse_grabbed > 0) 546 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
547 if ((obj->mouse_grabbed > 0) && (obj->layer))
540 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; 548 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
541 if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) 549 if (((obj->mouse_in) || (obj->mouse_grabbed > 0)) && (obj->layer))
542 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, eo_obj); 550 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, eo_obj);
543 obj->mouse_grabbed = 0; 551 obj->mouse_grabbed = 0;
544 obj->mouse_in = 0; 552 obj->mouse_in = 0;
@@ -559,7 +567,8 @@ _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
559 if (obj->is_smart) evas_object_smart_del(eo_obj); 567 if (obj->is_smart) evas_object_smart_del(eo_obj);
560 _evas_object_event_new(); 568 _evas_object_event_new();
561 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter); 569 evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter);
562 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas); 570 if (obj->layer)
571 _evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas);
563 evas_object_smart_cleanup(eo_obj); 572 evas_object_smart_cleanup(eo_obj);
564 obj->delete_me = 1; 573 obj->delete_me = 1;
565 evas_object_change(eo_obj, obj); 574 evas_object_change(eo_obj, obj);
@@ -713,7 +722,8 @@ _position_set(Eo *eo_obj, void *_pd, va_list *list)
713 int nx = 0, ny = 0; 722 int nx = 0, ny = 0;
714 723
715 if (obj->delete_me) return; 724 if (obj->delete_me) return;
716 725 if (!obj->layer) return;
726
717 nx = x; 727 nx = x;
718 ny = y; 728 ny = y;
719 729
@@ -808,6 +818,7 @@ _size_set(Eo *eo_obj, void *_pd, va_list *list)
808 Eina_Bool source_invisible = EINA_FALSE; 818 Eina_Bool source_invisible = EINA_FALSE;
809 819
810 if (obj->delete_me) return; 820 if (obj->delete_me) return;
821 if (!obj->layer) return;
811 if (w < 0) w = 0; if (h < 0) h = 0; 822 if (w < 0) w = 0; if (h < 0) h = 0;
812 823
813 if (evas_object_intercept_call_resize(eo_obj, w, h)) return; 824 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)
893 Evas_Coord *x = va_arg(*list, Evas_Coord *); 904 Evas_Coord *x = va_arg(*list, Evas_Coord *);
894 Evas_Coord *y = va_arg(*list, Evas_Coord *); 905 Evas_Coord *y = va_arg(*list, Evas_Coord *);
895 906
896 if (obj->delete_me) 907 if ((obj->delete_me) || (!obj->layer))
897 { 908 {
898 if (x) *x = 0; if (y) *y = 0; 909 if (x) *x = 0; if (y) *y = 0;
899 return; 910 return;
@@ -1400,8 +1411,9 @@ _visible_set(Eo *eo_obj, void *_pd, va_list *list)
1400} 1411}
1401 1412
1402static void 1413static void
1403_show (Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) 1414_show(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1404{ 1415{
1416 if (!obj->layer) return;
1405 if (obj->delete_me) return; 1417 if (obj->delete_me) return;
1406 if (evas_object_intercept_call_show(eo_obj)) return; 1418 if (evas_object_intercept_call_show(eo_obj)) return;
1407 if (obj->is_smart) 1419 if (obj->is_smart)
@@ -1445,6 +1457,7 @@ _hide(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj)
1445 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ); 1457 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
1446 return; 1458 return;
1447 MAGIC_CHECK_END(); 1459 MAGIC_CHECK_END();
1460 if (!obj->layer) return;
1448 if (obj->delete_me) return; 1461 if (obj->delete_me) return;
1449 if (evas_object_intercept_call_hide(eo_obj)) return; 1462 if (evas_object_intercept_call_hide(eo_obj)) return;
1450 if (obj->is_smart) 1463 if (obj->is_smart)
@@ -1805,7 +1818,7 @@ _evas_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
1805 const Evas_Object_Protected_Data *obj = _pd; 1818 const Evas_Object_Protected_Data *obj = _pd;
1806 Evas **evas = va_arg(*list, Evas **); 1819 Evas **evas = va_arg(*list, Evas **);
1807 1820
1808 if (obj->delete_me) 1821 if ((obj->delete_me) || (!obj->layer))
1809 { 1822 {
1810 *evas = NULL; 1823 *evas = NULL;
1811 return; 1824 return;