This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit 92033486056c27b0297752e5276f14b7aae5d7b8
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Oct 30 00:00:16 2026 -0600

    elementary: Image_Zoomable drops a stale mmap and closes its file once
    
    Setting a file after an icon, or after any mmap, did not load the file:
    the mmap was still set and is what got loaded, so the load failed. A
    file set now drops a leftover mmap, unless that mmap is what is setting
    this very file.
    
    Setting an icon closed the previous file but left the pointer to it, so
    unload closed it a second time, a CRI from Eina Magic. Clear the
    pointer once it is closed.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_image_zoomable.c        | 10 +++++++-
 src/tests/elementary/efl_ui_test_image_zoomable.c | 30 +++++++++++++++++++++++
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index 38682ea197..f7b83caf8d 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -2391,8 +2391,15 @@ _efl_ui_image_zoomable_efl_file_load(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
 }
 
 EOLIAN static Eina_Error
-_efl_ui_image_zoomable_efl_file_file_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, const char *file)
+_efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, const char *file)
 {
+   const Eina_File *mmap = efl_file_mmap_get(obj);
+
+   /* A file set after an icon, or any mmap, is the file to load: the mmap
+    * would be what is loaded otherwise. Not when the mmap is what is
+    * setting this very file. */
+   if (mmap && !eina_streq(eina_file_filename_get(mmap), file))
+     efl_file_mmap_set(obj, NULL);
    eina_stringshare_replace(&sd->file, file);
    return 0;
 }
@@ -2819,6 +2826,7 @@ _image_zoomable_object_icon_set(Evas_Object *o, const char *group, char *style,
    if (f)
      {
         if (sd->f) eina_file_close(sd->f);
+        sd->f = NULL; /* or the unload closes it a second time */
         efl_file_key_set(o, buf);
         efl_file_mmap_set(o, f);
 
diff --git a/src/tests/elementary/efl_ui_test_image_zoomable.c b/src/tests/elementary/efl_ui_test_image_zoomable.c
index 70f51d7b52..c68c881ab9 100644
--- a/src/tests/elementary/efl_ui_test_image_zoomable.c
+++ b/src/tests/elementary/efl_ui_test_image_zoomable.c
@@ -71,8 +71,38 @@ EFL_START_TEST(efl_ui_test_image_zoomable_replaced_calc_job)
 }
 EFL_END_TEST
 
+EFL_START_TEST(efl_ui_test_image_zoomable_file_after_icon)
+{
+   Evas_Object *win, *img_zoomable, *reference;
+   Eina_Size2D expected, size;
+   int errors = 0;
+
+   win = win_add(NULL, "photocam", EFL_UI_WIN_TYPE_BASIC);
+
+   reference = efl_add(EFL_UI_IMAGE_CLASS, win);
+   ck_assert(efl_file_simple_load(reference, ELM_IMAGE_DATA_DIR"/images/logo.png", NULL));
+   expected = efl_gfx_view_size_get(reference);
+   ck_assert_int_gt(expected.w, 0);
+
+   img_zoomable = efl_add(EFL_UI_IMAGE_ZOOMABLE_CLASS, win);
+   ck_assert(efl_ui_image_icon_set(img_zoomable, "folder"));
+   ck_assert_int_eq(efl_file_set(img_zoomable, ELM_IMAGE_DATA_DIR"/images/logo.png"), 0);
+   ck_assert_int_eq(efl_file_load(img_zoomable), 0);
+
+   size = efl_gfx_view_size_get(img_zoomable);
+   ck_assert_int_eq(size.w, expected.w);
+   ck_assert_int_eq(size.h, expected.h);
+
+   eina_log_print_cb_set(_count_errors, &errors);
+   efl_del(img_zoomable);
+   eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
+   ck_assert_int_eq(errors, 0);
+}
+EFL_END_TEST
+
 void efl_ui_test_image_zoomable(TCase *tc)
 {
    tcase_add_test(tc, efl_ui_test_image_zoomable_icon);
    tcase_add_test(tc, efl_ui_test_image_zoomable_replaced_calc_job);
+   tcase_add_test(tc, efl_ui_test_image_zoomable_file_after_icon);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to