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

    elementary: Image_Zoomable's calc job is cancelled before it is replaced
    
    _img_proxy_set and _internal_file_set stored a new calc job over the
    previous one without deleting it. The replaced job stayed scheduled and
    ran later, possibly on a widget that was already destroyed, which showed
    up as "_sizing_eval() No widget data": a use after destroy. Unload also
    left the job's pointer dangling after deleting it.
    
    Delete the job before adding its replacement, and clear the pointer on
    unload.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_image_zoomable.c        |  4 ++-
 src/tests/elementary/efl_ui_test_image_zoomable.c | 41 +++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index 942c120f68..38682ea197 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -2022,6 +2022,7 @@ _img_proxy_set(Evas_Object *obj, Efl_Ui_Image_Zoomable_Data *sd,
    evas_object_image_preload(sd->img, 0);
    sd->main_load_pending = EINA_TRUE;
 
+   ecore_job_del(sd->calc_job);
    sd->calc_job = ecore_job_add(_calc_job_cb, obj);
    efl_event_callback_legacy_call(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD, NULL);
    sd->preload_num++;
@@ -2137,6 +2138,7 @@ _internal_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, Evas_Load_Error *ret
    evas_object_image_preload(sd->img, 0);
    sd->main_load_pending = EINA_TRUE;
 
+   ecore_job_del(sd->calc_job);
    sd->calc_job = ecore_job_add(_calc_job_cb, obj);
    efl_event_callback_legacy_call(obj, EFL_UI_IMAGE_ZOOMABLE_EVENT_LOAD, NULL);
    sd->preload_num++;
@@ -2355,7 +2357,7 @@ _efl_ui_image_zoomable_efl_file_unload(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd)
    sd->no_smooth--;
    if (sd->no_smooth == 0) _smooth_update(obj);
 
-   ecore_job_del(sd->calc_job);
+   ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
    evas_object_hide(sd->img);
    if (sd->f) eina_file_close(sd->f);
    sd->f = NULL;
diff --git a/src/tests/elementary/efl_ui_test_image_zoomable.c b/src/tests/elementary/efl_ui_test_image_zoomable.c
index d9d9e1032c..70f51d7b52 100644
--- a/src/tests/elementary/efl_ui_test_image_zoomable.c
+++ b/src/tests/elementary/efl_ui_test_image_zoomable.c
@@ -31,7 +31,48 @@ EFL_START_TEST(efl_ui_test_image_zoomable_icon)
 }
 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_test_image_zoomable_replaced_calc_job)
+{
+   Evas_Object *win, *img_zoomable;
+   int errors = 0, i;
+
+   win = win_add(NULL, "photocam", EFL_UI_WIN_TYPE_BASIC);
+
+   img_zoomable = efl_add(EFL_UI_IMAGE_ZOOMABLE_CLASS, win);
+   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);
+   ck_assert_int_eq(efl_file_set(img_zoomable, ELM_IMAGE_DATA_DIR"/images/bubble.png"), 0);
+   ck_assert_int_eq(efl_file_load(img_zoomable), 0);
+   efl_file_unload(img_zoomable);
+   ck_assert_int_eq(efl_file_load(img_zoomable), 0);
+
+   eina_log_print_cb_set(_count_errors, &errors);
+   efl_del(img_zoomable);
+   eina_freeq_clear(eina_freeq_main_get());
+   for (i = 0; i < 3; i++)
+     {
+        ecore_main_loop_iterate();
+     }
+   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);
 }

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

Reply via email to