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 06317981f4668cb2973cd3ecb6112092b9fa4e76
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Oct 31 15:09:53 2026 -0600

    elementary: a layout replays what happened to its parts in order
    
    Until a widget is finalized, the signals telling its theme that a part
    was filled or emptied are queued, and _deferred_signals_emit replayed
    them by popping the queue: newest first. A part filled then emptied
    while its owner was made therefore ended with the theme told it was
    filled: a button given an icon and then losing it during construction
    laid itself out as if it still had one.
    
    The queue is now walked from its start. It is detached before the walk
    so a signal queued while it is replayed cannot reuse a slot whose
    strings are still to be freed. Every signal queued comes from
    _signals_emit, as set and unset pairs whose only meaning is the order
    they happened in, so nothing relied on the reverse.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_layout.c        | 13 ++++++++-----
 src/tests/elementary/efl_ui_suite.c       |  1 +
 src/tests/elementary/efl_ui_suite.h       |  1 +
 src/tests/elementary/efl_ui_test_button.c | 31 +++++++++++++++++++++++++++++++
 src/tests/elementary/meson.build          |  1 +
 5 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index d1c2bb0d00..2ffbcbd4ce 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -557,18 +557,21 @@ _efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Widget_Smart_
 static void
 _deferred_signals_emit(Efl_Ui_Layout_Data *pd)
 {
-   do
-     {
-        Deferred_Version_Signal *dvs = eina_inarray_pop(pd->deferred_signals);
+   Eina_Inarray *signals = pd->deferred_signals;
+   Deferred_Version_Signal *dvs;
 
+   /* In the order they were sent: a part filled then emptied is empty. */
+   pd->deferred_signals = NULL;
+   EINA_INARRAY_FOREACH(signals, dvs)
+     {
         if (pd->version < dvs->version_threshold)
           efl_layout_signal_emit(pd->obj, dvs->old_sig, "efl");
         else
           efl_layout_signal_emit(pd->obj, dvs->new_sig, "efl");
         eina_stringshare_del(dvs->old_sig);
         eina_stringshare_del(dvs->new_sig);
-     } while (eina_inarray_count(pd->deferred_signals));
-   ELM_SAFE_FREE(pd->deferred_signals, eina_inarray_free);
+     }
+   eina_inarray_free(signals);
 }
 
 EOLIAN static Eina_Error
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index 11adc9d70b..582a3f9027 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -30,6 +30,7 @@ static const Efl_Test_Case etc[] = {
   { "efl_ui_check", efl_ui_test_check },
   { "efl_ui_property_bind", efl_ui_test_property_bind },
   { "efl_ui_popup", efl_ui_test_popup },
+  { "efl_ui_button", efl_ui_test_button },
   { "efl_ui_progressbar", efl_ui_test_progressbar },
   { "efl_ui_radio_group", efl_ui_test_radio_group },
   { "efl_ui_scroller", efl_ui_test_scroller },
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index 3c57b063e2..9b6a00d8bd 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -39,6 +39,7 @@ void efl_ui_test_widget(TCase *tc);
 void efl_ui_test_spotlight(TCase *tc);
 void efl_ui_test_check(TCase *tc);
 void efl_ui_test_property_bind(TCase *tc);
+void efl_ui_test_button(TCase *tc);
 void efl_ui_test_progressbar(TCase *tc);
 void efl_ui_test_radio_group(TCase *tc);
 void efl_ui_test_slider(TCase *tc);
diff --git a/src/tests/elementary/efl_ui_test_button.c b/src/tests/elementary/efl_ui_test_button.c
new file mode 100644
index 0000000000..8a41809ee2
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_button.c
@@ -0,0 +1,31 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Efl_Ui.h>
+#include <Elementary.h>
+#include "efl_ui_suite.h"
+
+/* What the theme hears about the parts of a layout while it is made, it hears
+ * in the order it happened: an icon given and taken back leaves the text. */
+EFL_START_TEST(efl_ui_button_deferred_signals_in_order)
+{
+   Eo *win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+   Eo *icon = efl_add(EFL_UI_BOX_CLASS, win);
+   Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, win,
+                     efl_text_set(efl_added, "A"),
+                     efl_content_set(efl_added, icon),
+                     efl_del(efl_content_unset(efl_added)));
+
+   get_me_to_those_events(win);
+   ck_assert_ptr_eq(efl_content_get(btn), NULL);
+   ck_assert_str_eq(edje_object_part_state_get(elm_layout_edje_get(btn), "efl.text", NULL),
+                    "textonly");
+}
+EFL_END_TEST
+
+void
+efl_ui_test_button(TCase *tc)
+{
+   tcase_add_test(tc, efl_ui_button_deferred_signals_in_order);
+}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 9e765832f7..767e0c5278 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -156,6 +156,7 @@ efl_ui_suite_src = [
   'efl_ui_test_check.c',
   'efl_ui_test_property_bind.c',
   'efl_ui_test_radio_group.c',
+  'efl_ui_test_button.c',
   'efl_ui_test_progressbar.c',
   'efl_ui_test_spin.c',
   'efl_ui_test_spin_button.c',

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

Reply via email to