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 a5b79b3e18124927c233a71ee7bfac40cc71f48e
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Oct 30 00:00:16 2026 -0600

    efl: Efl.File mmap_set(NULL) sets no file name from a NULL file
    
    Clearing the mmap passed the NULL file to eina_file_filename_get(),
    which logs a safety error when Eina Magic debug is on and dereferences
    NULL when it is off. Pass NULL on directly instead: there is no file,
    so there is no name to set.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/efl/interfaces/efl_file.c        |  2 +-
 src/tests/elementary/efl_ui_test_image.c | 34 ++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c
index 5724eeb906..5583c077e0 100644
--- a/src/lib/efl/interfaces/efl_file.c
+++ b/src/lib/efl/interfaces/efl_file.c
@@ -75,7 +75,7 @@ _efl_file_mmap_set(Eo *obj, Efl_File_Data *pd, const Eina_File *f)
      {
         /* avoid infinite recursion */
         pd->setting = 1;
-        err = efl_file_set(obj, eina_file_filename_get(pd->file));
+        err = efl_file_set(obj, pd->file ? eina_file_filename_get(pd->file) : NULL);
         pd->setting = 0;
      }
    return err;
diff --git a/src/tests/elementary/efl_ui_test_image.c b/src/tests/elementary/efl_ui_test_image.c
index 9749edfd1e..0160684132 100644
--- a/src/tests/elementary/efl_ui_test_image.c
+++ b/src/tests/elementary/efl_ui_test_image.c
@@ -133,10 +133,44 @@ EFL_START_TEST(efl_ui_image_test_load_size_bounds_the_decode)
 }
 EFL_END_TEST
 
+static void
+_count_errors(const Eina_Log_Domain *d, Eina_Log_Level level,
+              const char *file, const char *fnc, int line,
+              const char *fmt, void *data, va_list args)
+{
+   int *errors = data;
+
+   if (level <= EINA_LOG_LEVEL_ERR)
+     (*errors)++;
+   eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, NULL, args);
+}
+
+EFL_START_TEST(efl_ui_image_test_mmap_set_null)
+{
+   Eo *win, *image;
+   int errors = 0;
+
+   win = win_add(NULL, "image", EFL_UI_WIN_TYPE_BASIC);
+
+   image = efl_add(EFL_UI_IMAGE_CLASS, win);
+   ck_assert(efl_file_simple_load(image, ELM_IMAGE_DATA_DIR"/images/logo.png", NULL));
+   ck_assert_ptr_ne(efl_file_get(image), NULL);
+
+   eina_log_print_cb_set(_count_errors, &errors);
+   efl_file_mmap_set(image, NULL);
+   eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
+
+   ck_assert_int_eq(errors, 0);
+   ck_assert_ptr_eq(efl_file_mmap_get(image), NULL);
+   ck_assert_ptr_eq(efl_file_get(image), NULL);
+}
+EFL_END_TEST
+
 void efl_ui_test_image(TCase *tc)
 {
    tcase_add_test(tc, efl_ui_image_test_icon);
    tcase_add_test(tc, efl_ui_image_test_border_insets_before_load);
    tcase_add_test(tc, efl_ui_image_test_scale_method);
    tcase_add_test(tc, efl_ui_image_test_load_size_bounds_the_decode);
+   tcase_add_test(tc, efl_ui_image_test_mmap_set_null);
 }

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

Reply via email to