aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYeongjong Lee <cleanlyj@naver.com>2018-08-16 10:01:37 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-16 10:01:37 -0400
commit07692dc6402e3ef082fbea593e6918d8771ee647 (patch)
treef7c702b3ad57ca92fd6d86c6398a0e19efdbe362
parentci: disable notifications for canceled builds (diff)
downloadefl-07692dc6402e3ef082fbea593e6918d8771ee647.tar.gz
elm_image: create image object before call elm_image_object_get
Summary: image object was created in group_add before 868e3308. if you call elm_image_object_get before file_set, you can get NULL. this patch avoid that. Test Plan: obj = elm_image_add(...); img = elm_image_object_get(obj); img should not be NULL. Reviewers: Hermet, zmike Reviewed By: zmike Subscribers: JackDanielZ, cedric, #reviewers, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6828
-rw-r--r--src/lib/elementary/efl_ui_image.c3
-rw-r--r--src/lib/elementary/elm_image_legacy.h2
-rw-r--r--src/tests/elementary/elm_test_image.c14
3 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index b6a61e5ac8..8398a47724 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -2128,6 +2128,9 @@ elm_image_object_get(const Evas_Object *obj)
{
EFL_UI_IMAGE_CHECK(obj) NULL;
EFL_UI_IMAGE_DATA_GET(obj, sd);
+ if (!sd->img)
+ sd->img = _img_new((Evas_Object *)obj);
+
return sd->img;
}
diff --git a/src/lib/elementary/elm_image_legacy.h b/src/lib/elementary/elm_image_legacy.h
index 0f8722de9b..54c920e2f1 100644
--- a/src/lib/elementary/elm_image_legacy.h
+++ b/src/lib/elementary/elm_image_legacy.h
@@ -434,7 +434,7 @@ EAPI Elm_Image_Orient elm_image_orient_get(const Evas_Object *obj);
*
* @note Be careful to not manipulate it, as it is under control of elementary.
*
- * @return The inlined image object, or NULL if none exists
+ * @return The inlined image object.
*
* @ingroup Elm_Image
*/
diff --git a/src/tests/elementary/elm_test_image.c b/src/tests/elementary/elm_test_image.c
index 637cc96219..e1e36b4f82 100644
--- a/src/tests/elementary/elm_test_image.c
+++ b/src/tests/elementary/elm_test_image.c
@@ -213,6 +213,19 @@ EFL_START_TEST (elm_image_evas_object_color_set)
}
EFL_END_TEST
+EFL_START_TEST (elm_image_evas_image_get)
+{
+ Evas_Object *win, *image, *obj;
+
+ win = win_add(NULL, "image", ELM_WIN_BASIC);
+
+ image = elm_image_add(win);
+ obj = elm_image_object_get(image);
+
+ ck_assert(obj);
+}
+EFL_END_TEST
+
EFL_START_TEST (efl_ui_image_icon)
{
Evas_Object *win, *image;
@@ -244,5 +257,6 @@ void elm_test_image(TCase *tc)
tcase_add_test(tc, elm_image_async_path);
tcase_add_test(tc, elm_image_async_mmap);
tcase_add_test(tc, elm_image_evas_object_color_set);
+ tcase_add_test(tc, elm_image_evas_image_get);
tcase_add_test(tc, efl_ui_image_icon);
}