From 59351f8aac920bdf8e1b192c9d698499e528b2c2 Mon Sep 17 00:00:00 2001 From: helen Date: Thu, 25 Nov 2010 15:16:48 +0000 Subject: [PATCH] Fix elm_bg_file_set/get If the file is a NULL pointer, it will delete the old imagem and set its internal strings about file and group to NULL. In the get function if the file argument is null does not mean that it will not retrieve the group too. SVN revision: 54986 --- legacy/elementary/src/lib/elm_bg.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/legacy/elementary/src/lib/elm_bg.c b/legacy/elementary/src/lib/elm_bg.c index f4ca338c48..43b230e9bd 100644 --- a/legacy/elementary/src/lib/elm_bg.c +++ b/legacy/elementary/src/lib/elm_bg.c @@ -165,6 +165,9 @@ elm_bg_add(Evas_Object *parent) * will be stretched (retaining aspect if its an image file) to completely fill * the bg object. This may mean some parts are not visible. * + * @note Once the image of @p obj is set, a previously set one will be deleted, + * even if @p file is NULL. + * * @ingroup Bg */ EAPI void @@ -179,7 +182,14 @@ elm_bg_file_set(Evas_Object *obj, const char *file, const char *group) evas_object_del(wd->img); wd->img = NULL; } - if (!file) return; + if (!file) + { + eina_stringshare_del(wd->file); + wd->file = NULL; + eina_stringshare_del(wd->group); + wd->group = NULL; + return; + } eina_stringshare_replace(&wd->file, file); eina_stringshare_replace(&wd->group, group); if (((p = strrchr(file, '.'))) && (!strcasecmp(p, ".edj"))) @@ -212,7 +222,6 @@ elm_bg_file_get(const Evas_Object *obj, const char **file, const char **group) { ELM_CHECK_WIDTYPE(obj, widtype); Widget_Data *wd = elm_widget_data_get(obj); - if (!file) return; if (file) *file = wd->file; if (group) *group = wd->group; }