elc_popup: add null pointer check before creating content text object

Summary:
If elm_object_text_set() function is called twice,
elm_obj_containter_content_set(CONTENT_PART, sd->text_content_obj)
function makes sd->text_content_obj null since sd->text_content_obj already exists.

Test Plan:
1. run elementary_test(popup) and excute "popup-center-text + 1button (check hide, show)"
2. print sd->text_content_obj value in content_text_set()
3. push hide button and excute the example again
4. check sd->text_content_obj value if null or not

Reviewers: woohyun, Hermet, raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D2225
This commit is contained in:
taehyub 2015-03-26 03:02:15 +09:00 committed by Carsten Haitzler (Rasterman)
parent c361c9e839
commit d48b15b2fd
1 changed files with 7 additions and 0 deletions

View File

@ -886,6 +886,13 @@ _content_text_set(Evas_Object *obj,
else eo_do(sd->main_layout, elm_obj_container_content_set(CONTENT_PART, sd->content_area));
if (!text) goto end;
if (sd->text_content_obj)
{
eo_do(sd->content_area, sd->text_content_obj = elm_obj_container_content_unset(CONTENT_PART));
evas_object_del(sd->text_content_obj);
sd->text_content_obj = NULL;
}
sd->text_content_obj = elm_label_add(sd->content_area);
snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(obj));
elm_object_style_set(sd->text_content_obj, style);