forked from enlightenment/efl
Always check for valid evas object.
If you try to create a new widget, you must be sure that the parent is really an evas object. With the previous implementation it was possible to call an _add function for an elementary widget with any non-null pointer as parent eventually causing crashes (like with the elm_box). SVN revision: 55521
This commit is contained in:
parent
412b5ced60
commit
ff67ce31fb
|
@ -187,6 +187,7 @@ elm_anchorblock_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "anchorblock");
|
||||
elm_widget_type_set(obj, "anchorblock");
|
||||
|
|
|
@ -178,6 +178,7 @@ elm_anchorview_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "anchorview");
|
||||
elm_widget_type_set(obj, "anchorview");
|
||||
|
|
|
@ -363,6 +363,7 @@ elm_ctxpopup_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
wd->evas = evas_object_evas_get(parent);
|
||||
if (!wd->evas) return NULL;
|
||||
obj = elm_widget_add(wd->evas);
|
||||
ELM_SET_WIDTYPE(widtype, "ctxpopup");
|
||||
elm_widget_type_set(obj, "ctxpopup");
|
||||
|
|
|
@ -551,6 +551,7 @@ elm_fileselector_add(Evas_Object *parent)
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||
|
||||
Evas *e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
Evas_Object *obj, *ic, *bt, *li, *en, *grid;
|
||||
Widget_Data *wd;
|
||||
int s;
|
||||
|
|
|
@ -260,6 +260,7 @@ elm_fileselector_button_add(Evas_Object *parent)
|
|||
wd->h = 400;
|
||||
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "fileselector_button");
|
||||
elm_widget_type_set(obj, "fileselector_button");
|
||||
|
|
|
@ -211,6 +211,7 @@ elm_fileselector_entry_add(Evas_Object *parent)
|
|||
{
|
||||
Evas_Object *obj;
|
||||
Evas *e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
Widget_Data *wd;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||
|
|
|
@ -262,6 +262,7 @@ elm_hoversel_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "hoversel");
|
||||
elm_widget_type_set(obj, "hoversel");
|
||||
|
|
|
@ -364,6 +364,7 @@ elm_scrolled_entry_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "scrolled_entry");
|
||||
elm_widget_type_set(obj, "scrolled_entry");
|
||||
|
|
|
@ -271,6 +271,7 @@ elm_actionslider_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "actionslider");
|
||||
elm_widget_type_set(obj, "actionslider");
|
||||
|
|
|
@ -136,6 +136,7 @@ elm_bg_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "bg");
|
||||
elm_widget_type_set(obj, "bg");
|
||||
|
|
|
@ -344,6 +344,7 @@ elm_box_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "box");
|
||||
elm_widget_type_set(obj, "box");
|
||||
|
|
|
@ -152,6 +152,7 @@ elm_bubble_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "bubble");
|
||||
elm_widget_type_set(obj, "bubble");
|
||||
|
|
|
@ -302,6 +302,7 @@ elm_button_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "button");
|
||||
elm_widget_type_set(obj, "button");
|
||||
|
|
|
@ -718,6 +718,7 @@ elm_calendar_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "calendar");
|
||||
elm_widget_type_set(obj, "calendar");
|
||||
|
|
|
@ -239,6 +239,7 @@ elm_check_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "check");
|
||||
elm_widget_type_set(obj, "check");
|
||||
|
|
|
@ -534,6 +534,7 @@ elm_clock_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "clock");
|
||||
elm_widget_type_set(obj, "clock");
|
||||
|
|
|
@ -814,6 +814,7 @@ elm_colorselector_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "colorselector");
|
||||
elm_widget_type_set(obj, "colorselector");
|
||||
|
|
|
@ -220,6 +220,7 @@ elm_conformant_add(Evas_Object *parent)
|
|||
wd = ELM_NEW(Widget_Data);
|
||||
|
||||
evas = evas_object_evas_get(parent);
|
||||
if (!evas) return NULL;
|
||||
|
||||
obj = elm_widget_add(evas);
|
||||
ELM_SET_WIDTYPE(widtype, "conformant");
|
||||
|
|
|
@ -1576,6 +1576,7 @@ elm_entry_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "entry");
|
||||
elm_widget_type_set(obj, "entry");
|
||||
|
|
|
@ -409,6 +409,7 @@ elm_flip_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "flip");
|
||||
elm_widget_type_set(obj, "flip");
|
||||
|
|
|
@ -572,6 +572,7 @@ elm_flipselector_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
wd->self = obj;
|
||||
ELM_SET_WIDTYPE(widtype, "flipselector");
|
||||
|
|
|
@ -117,6 +117,7 @@ elm_frame_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "frame");
|
||||
elm_widget_type_set(obj, "frame");
|
||||
|
|
|
@ -1495,6 +1495,7 @@ elm_gengrid_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "gengrid");
|
||||
elm_widget_type_set(obj, "gengrid");
|
||||
|
|
|
@ -2301,6 +2301,7 @@ elm_genlist_add(Evas_Object *parent)
|
|||
}
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "genlist");
|
||||
elm_widget_type_set(obj, "genlist");
|
||||
|
|
|
@ -484,6 +484,7 @@ elm_hover_add(Evas_Object *parent)
|
|||
wd->subs[i].swallow = _directions[i];
|
||||
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "hover");
|
||||
elm_widget_type_set(obj, "hover");
|
||||
|
|
|
@ -190,6 +190,7 @@ elm_icon_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "icon");
|
||||
elm_widget_type_set(obj, "icon");
|
||||
|
|
|
@ -118,6 +118,7 @@ elm_image_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "image");
|
||||
elm_widget_type_set(obj, "image");
|
||||
|
|
|
@ -497,6 +497,7 @@ elm_index_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "index");
|
||||
elm_widget_type_set(obj, "index");
|
||||
|
|
|
@ -422,6 +422,7 @@ elm_label_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
wd->bgcolor = EINA_FALSE;
|
||||
wd->bg = evas_object_rectangle_add(e);
|
||||
evas_object_color_set(wd->bg, 0, 0, 0, 0);
|
||||
|
|
|
@ -314,6 +314,7 @@ elm_layout_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
wd->obj = obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "layout");
|
||||
elm_widget_type_set(obj, "layout");
|
||||
|
|
|
@ -1226,6 +1226,7 @@ elm_list_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
wd->self = obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "list");
|
||||
elm_widget_type_set(obj, "list");
|
||||
|
|
|
@ -1684,6 +1684,7 @@ elm_map_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "map");
|
||||
elm_widget_type_set(obj, "map");
|
||||
|
|
|
@ -171,6 +171,7 @@ elm_mapbuf_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "mapbuf");
|
||||
elm_widget_type_set(obj, "mapbuf");
|
||||
|
|
|
@ -416,6 +416,7 @@ elm_menu_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "menu");
|
||||
elm_widget_type_set(obj, "menu");
|
||||
|
|
|
@ -328,6 +328,7 @@ elm_notify_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "notify");
|
||||
elm_widget_type_set(obj, "notify");
|
||||
|
|
|
@ -246,6 +246,7 @@ elm_pager_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "pager");
|
||||
elm_widget_type_set(obj, "pager");
|
||||
|
|
|
@ -243,6 +243,7 @@ elm_panel_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
evas = evas_object_evas_get(parent);
|
||||
if (!evas) return NULL;
|
||||
obj = elm_widget_add(evas);
|
||||
ELM_SET_WIDTYPE(widtype, "panel");
|
||||
elm_widget_type_set(obj, "panel");
|
||||
|
|
|
@ -203,6 +203,7 @@ elm_panes_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "panes");
|
||||
elm_widget_type_set(obj, "panes");
|
||||
|
|
|
@ -210,6 +210,7 @@ elm_photo_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "photo");
|
||||
elm_widget_type_set(obj, "photo");
|
||||
|
|
|
@ -979,6 +979,7 @@ elm_photocam_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "photocam");
|
||||
elm_widget_type_set(obj, "photocam");
|
||||
|
|
|
@ -191,6 +191,7 @@ elm_progressbar_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "progressbar");
|
||||
elm_widget_type_set(obj, "progressbar");
|
||||
|
|
|
@ -276,6 +276,7 @@ elm_radio_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "radio");
|
||||
elm_widget_type_set(obj, "radio");
|
||||
|
|
|
@ -447,6 +447,7 @@ elm_scroller_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "scroller");
|
||||
elm_widget_type_set(obj, "scroller");
|
||||
|
|
|
@ -74,6 +74,7 @@ elm_separator_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "separator");
|
||||
wd->horizontal = EINA_FALSE;
|
||||
|
|
|
@ -453,6 +453,7 @@ elm_slider_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "slider");
|
||||
elm_widget_type_set(obj, "slider");
|
||||
|
|
|
@ -296,6 +296,7 @@ elm_slideshow_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "slideshow");
|
||||
elm_widget_type_set(obj, "slideshow");
|
||||
|
|
|
@ -563,6 +563,7 @@ elm_spinner_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "spinner");
|
||||
elm_widget_type_set(obj, "spinner");
|
||||
|
|
|
@ -126,6 +126,7 @@ elm_table_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "table");
|
||||
elm_widget_type_set(obj, "table");
|
||||
|
|
|
@ -429,6 +429,7 @@ elm_thumb_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
evas = evas_object_evas_get(parent);
|
||||
if (!evas) return NULL;
|
||||
obj = elm_widget_add(evas);
|
||||
ELM_SET_WIDTYPE(widtype, "thumb");
|
||||
elm_widget_type_set(obj, "thumb");
|
||||
|
|
|
@ -211,6 +211,7 @@ elm_toggle_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "toggle");
|
||||
elm_widget_type_set(obj, "toggle");
|
||||
|
|
|
@ -676,6 +676,7 @@ elm_toolbar_add(Evas_Object *parent)
|
|||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
if (!e) return NULL;
|
||||
obj = elm_widget_add(e);
|
||||
ELM_SET_WIDTYPE(widtype, "toolbar");
|
||||
elm_widget_type_set(obj, "toolbar");
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
* // basic - allocate data for widget and fill it
|
||||
* wd = ELM_NEW(Widget_Data);
|
||||
* e = evas_object_evas_get(parent);
|
||||
* if (!e) return NULL;
|
||||
* obj = elm_widget_add(e);
|
||||
* // give it a type name and set yp a mywidget type string if needed
|
||||
* ELM_SET_WIDTYPE(widtype, "mywidget");
|
||||
|
|
Loading…
Reference in New Issue