From 3d7bb72fd25b1d5aba4588fe22d298621c42465a Mon Sep 17 00:00:00 2001 From: hermet Date: Fri, 24 Feb 2012 06:53:03 +0000 Subject: [PATCH] elementary/widget - modified to check delete_me inside MACRO. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68387 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_widget.c | 3 +-- src/lib/elm_widget.h | 48 +++++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index b493d0e..ecc9e20 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -2841,8 +2841,7 @@ _elm_widget_item_new(Evas_Object *widget, EAPI void _elm_widget_item_free(Elm_Widget_Item *item) { - ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); - + ELM_WIDGET_ITEM_FREE_OR_RETURN(item); Elm_Object_Item_Smart_Cb cb; if (item->walking > 0) diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 2d9c6ee..5a46a1a 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -682,29 +682,31 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out #define elm_widget_item_smart_callback_call(item, event, event_info) \ _elm_widget_item_smart_callback_call((Elm_Widget_Item *) item, event, event_info) -#define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \ - do { \ - if (!item) { \ - CRITICAL("Elm_Widget_Item " # item " is NULL!"); \ - return __VA_ARGS__; \ - } \ - if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \ - EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \ - return __VA_ARGS__; \ - } \ - } while (0) - -#define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \ - do { \ - if (!item) { \ - CRITICAL("Elm_Widget_Item " # item " is NULL!"); \ - goto label; \ - } \ - if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \ - EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \ - goto label; \ - } \ - } while (0) +#define ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, ...) \ + ELM_WIDGET_ITEM_FREE_OR_RETURN(item, __VA_ARGS__); \ + do { \ + if (((Elm_Widget_Item *)item)->delete_me) { \ + CRITICAL("Elm_Widget_Item " # item " is deleted!"); \ + return __VA_ARGS__; \ + } \ + } while (0) + +#define ELM_WIDGET_ITEM_CHECK_OR_GOTO(item, label) \ + ELM_WIDGET_ITEM_FREE_OR_RETURN(item); \ + do { \ + if (((Elm_Widget_Item *)item)->delete_me) { \ + CRITICAL("Elm_Widget_Item " # item " is deleted!"); \ + goto label; \ + } \ + } while (0) + +#define ELM_WIDGET_ITEM_FREE_OR_RETURN(item, ...) \ + do { \ + if (!EINA_MAGIC_CHECK(item, ELM_WIDGET_ITEM_MAGIC)) { \ + EINA_MAGIC_FAIL(item, ELM_WIDGET_ITEM_MAGIC); \ + return __VA_ARGS__; \ + } \ + } while (0) #define ELM_SET_WIDTYPE(widtype, type) \ do { \ -- 2.7.4