elementary: Add ELM_WIDGET_DATA_GET macro

There are cases, such as 2abe5ad9bc where we do not
always want to return if we fail to get the elm widget data (as we may
have to cleanup leaks, etc). As such, add a macro we can call which
will just try to fetch the elm_widget data.
This commit is contained in:
Christopher Michael 2019-03-18 15:13:36 -04:00
parent d8c770be1c
commit 28400e3260
1 changed files with 7 additions and 0 deletions

View File

@ -714,6 +714,13 @@ Efl_Canvas_Object * _efl_ui_widget_bg_get(const Efl_Ui_Widget *obj);
return __VA_ARGS__; \
}
#define ELM_WIDGET_DATA_GET(o, ptr) \
Elm_Widget_Smart_Data *ptr; \
ptr = efl_data_scope_get(o, EFL_UI_WIDGET_CLASS); \
if (EINA_UNLIKELY(!ptr)) \
ERR("No widget data for object %p (%s)", \
o, evas_object_type_get(o));
#define ELM_WIDGET_CHECK(obj) \
if (EINA_UNLIKELY(!efl_isa((obj), EFL_UI_WIDGET_CLASS))) \
return