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 fbdcd46456250af4d82dfc55f0a21f3b1825c74e
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 12:43:21 2026 -0600
efl: classes of only static methods are abstract, guard their helpers
Some public API calls take the process down.
Efl.Text_Markup_Util, Efl.Ui.View_Factory, Efl.Ui.Action_Connector,
Efl.Ui.Focus.Util and Efl.Ui.Spotlight.Util are namespaces rather than
classes: data: null and nothing but @static methods. efl_add() on any
of them segfaults, because there is no instance for the class to be.
They are abstract now, which is what they always were, and efl_add()
declines instead.
Efl.Ui.Image_Zoomable_Pan is handed its widget straight after efl_add,
so it cannot refuse at finalize; every method that reads psd->wsd now
checks it.
In Efl.Ui.Calendar_Item.day_number the safety check on the resolved
part came after the part was handed to the focus redirector, so a day
that resolved to nothing was registered as NULL rather than rejected.
The check now runs before the use, which is what it was written to do,
and the focus setter and geometry getter cope with an item without a
part.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/efl/interfaces/efl_text_markup_util.eo | 2 +-
src/lib/efl/interfaces/efl_ui_view_factory.eo | 2 +-
src/lib/elementary/efl_ui_action_connector.eo | 2 +-
src/lib/elementary/efl_ui_calendar.c | 10 ++++++-
src/lib/elementary/efl_ui_focus_util.eo | 2 +-
src/lib/elementary/efl_ui_image_zoomable.c | 15 +++++++++-
src/lib/elementary/efl_ui_spotlight_util.eo | 2 +-
src/tests/elementary/efl_ui_suite.c | 1 +
src/tests/elementary/efl_ui_suite.h | 1 +
src/tests/elementary/efl_ui_test_calendar.c | 36 +++++++++++++++++++++++
src/tests/elementary/efl_ui_test_image_zoomable.c | 33 +++++++++++++++++++++
src/tests/elementary/efl_ui_test_spotlight.c | 15 ++++++++++
src/tests/elementary/meson.build | 1 +
13 files changed, 115 insertions(+), 7 deletions(-)
diff --git a/src/lib/efl/interfaces/efl_text_markup_util.eo b/src/lib/efl/interfaces/efl_text_markup_util.eo
index 7f83a10272..8540f08c90 100644
--- a/src/lib/efl/interfaces/efl_text_markup_util.eo
+++ b/src/lib/efl/interfaces/efl_text_markup_util.eo
@@ -1,4 +1,4 @@
-class @beta Efl.Text_Markup_Util {
+abstract @beta Efl.Text_Markup_Util {
[[Utility class for markup, such as conversions
]]
data: null;
diff --git a/src/lib/efl/interfaces/efl_ui_view_factory.eo b/src/lib/efl/interfaces/efl_ui_view_factory.eo
index f4774300a5..8625b7d489 100644
--- a/src/lib/efl/interfaces/efl_ui_view_factory.eo
+++ b/src/lib/efl/interfaces/efl_ui_view_factory.eo
@@ -1,4 +1,4 @@
-class @beta Efl.Ui.View_Factory
+abstract @beta Efl.Ui.View_Factory
{
[[This class provide a utility function that class that wish to use @Efl.Ui.Factory.create should use.]]
data: null;
diff --git a/src/lib/elementary/efl_ui_action_connector.eo b/src/lib/elementary/efl_ui_action_connector.eo
index 1c3f4f7ee2..09f6be1b83 100644
--- a/src/lib/elementary/efl_ui_action_connector.eo
+++ b/src/lib/elementary/efl_ui_action_connector.eo
@@ -1,4 +1,4 @@
-class @beta Efl.Ui.Action_Connector {
+abstract @beta Efl.Ui.Action_Connector {
[[Helper class that connects theme signals or object events to the interfaces which are for actions.
For example, this simplifies creating widgets that implement the @Efl.Input.Clickable interface.
diff --git a/src/lib/elementary/efl_ui_calendar.c b/src/lib/elementary/efl_ui_calendar.c
index fb780d9a9a..8513b12546 100644
--- a/src/lib/elementary/efl_ui_calendar.c
+++ b/src/lib/elementary/efl_ui_calendar.c
@@ -1182,7 +1182,11 @@ _efl_ui_calendar_item_day_number_set(Eo *obj, Efl_Ui_Calendar_Item_Data *pd, int
pd->v = i;
snprintf(pname, sizeof(pname), "efl.cit_%i.access", i);
+ /* The day cells live in the calendar's theme, so there is only something
+ * to find when this item's parent is a calendar. */
o = elm_layout_edje_get(efl_parent_get(obj));
+ EINA_SAFETY_ON_NULL_RETURN(o);
+
edje_object_freeze(o);
po = (Evas_Object *)edje_object_part_object_get(o, pname);
edje_object_thaw(o);
@@ -1191,9 +1195,10 @@ _efl_ui_calendar_item_day_number_set(Eo *obj, Efl_Ui_Calendar_Item_Data *pd, int
pd->part = po;
else
pd->part = evas_object_data_get(po, "_part_access_obj");
- _efl_ui_focus_event_redirector(pd->part, obj);
EINA_SAFETY_ON_NULL_RETURN(pd->part);
+
+ _efl_ui_focus_event_redirector(pd->part, obj);
}
EOLIAN static int
@@ -1208,12 +1213,15 @@ _efl_ui_calendar_item_efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Calendar_Ite
efl_ui_focus_object_focus_set(efl_super(obj, EFL_UI_CALENDAR_ITEM_CLASS), focus);
_update_focused_it(efl_parent_get(obj), pd->v);
+
+ if (!pd->part) return;
evas_object_focus_set(pd->part, efl_ui_focus_object_focus_get(obj));
}
EOLIAN static Eina_Rect
_efl_ui_calendar_item_efl_ui_focus_object_focus_geometry_get(const Eo *obj EINA_UNUSED, Efl_Ui_Calendar_Item_Data *pd)
{
+ if (!pd->part) return EINA_RECT(0, 0, 0, 0);
return efl_gfx_entity_geometry_get(pd->part);
}
diff --git a/src/lib/elementary/efl_ui_focus_util.eo b/src/lib/elementary/efl_ui_focus_util.eo
index 703ccf5b64..fedf4bad9b 100644
--- a/src/lib/elementary/efl_ui_focus_util.eo
+++ b/src/lib/elementary/efl_ui_focus_util.eo
@@ -1,4 +1,4 @@
-class @beta Efl.Ui.Focus.Util extends Efl.Object {
+abstract @beta Efl.Ui.Focus.Util extends Efl.Object {
[[EFL UI Focus Utility class.
This class contains a series of static methods that simplify common focus management operations.
diff --git a/src/lib/elementary/efl_ui_image_zoomable.c b/src/lib/elementary/efl_ui_image_zoomable.c
index c910fa48cd..d3e8a07402 100644
--- a/src/lib/elementary/efl_ui_image_zoomable.c
+++ b/src/lib/elementary/efl_ui_image_zoomable.c
@@ -162,6 +162,10 @@ _efl_ui_image_zoomable_pan_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Image_Zoo
efl_gfx_entity_position_set(efl_super(obj, MY_PAN_CLASS), pos);
+ /* A pan is created by its zoomable and given the widget straight after;
+ * one built on its own never gets it, and everything below reads NULL. */
+ if (!psd->wsd) return;
+
ecore_job_del(psd->wsd->calc_job);
psd->wsd->calc_job = ecore_job_add(_calc_job_cb, psd->wobj);
}
@@ -174,6 +178,8 @@ _efl_ui_image_zoomable_pan_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Image_Zoomabl
efl_gfx_entity_size_set(efl_super(obj, MY_PAN_CLASS), sz);
+ if (!psd->wsd) return;
+
psd->wsd->resized = EINA_TRUE;
ecore_job_del(psd->wsd->calc_job);
psd->wsd->calc_job = ecore_job_add(_calc_job_cb, psd->wobj);
@@ -376,6 +382,8 @@ _efl_ui_image_zoomable_pan_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Imag
Eina_List *l;
Evas_Coord ox, oy, ow, oh;
+ if (!psd->wsd) return;
+
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
ELM_WIDGET_DATA_GET_OR_RETURN(psd->wobj, wd);
@@ -398,6 +406,7 @@ _efl_ui_image_zoomable_pan_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Imag
EOLIAN static void
_efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_set(Eo *obj, Efl_Ui_Image_Zoomable_Pan_Data *psd, Eina_Position2D pos)
{
+ if (!psd->wsd) return;
if ((pos.x == psd->wsd->pan_x) && (pos.y == psd->wsd->pan_y)) return;
psd->wsd->pan_x = pos.x;
psd->wsd->pan_y = pos.y;
@@ -409,6 +418,7 @@ _efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_set(Eo *obj, Efl_Ui_Image_Zoo
EOLIAN static Eina_Position2D
_efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Pan_Data *psd)
{
+ if (!psd->wsd) return EINA_POSITION2D(0, 0);
return EINA_POSITION2D(psd->wsd->pan_x, psd->wsd->pan_y);
}
@@ -417,6 +427,8 @@ _efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_max_get(const Eo *obj, Efl_Ui
{
Evas_Coord ow, oh;
+ if (!psd->wsd) return EINA_POSITION2D(0, 0);
+
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
ow = psd->wsd->minw - ow;
if (ow < 0) ow = 0;
@@ -435,13 +447,14 @@ _efl_ui_image_zoomable_pan_efl_ui_pan_pan_position_min_get(const Eo *obj EINA_UN
EOLIAN static Eina_Size2D
_efl_ui_image_zoomable_pan_efl_ui_pan_content_size_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Pan_Data *psd)
{
+ if (!psd->wsd) return EINA_SIZE2D(0, 0);
return EINA_SIZE2D(psd->wsd->minw, psd->wsd->minh);
}
EOLIAN static void
_efl_ui_image_zoomable_pan_efl_object_destructor(Eo *obj, Efl_Ui_Image_Zoomable_Pan_Data *psd)
{
- efl_data_unref(psd->wobj, psd->wsd);
+ if (psd->wsd) efl_data_unref(psd->wobj, psd->wsd);
efl_destructor(efl_super(obj, MY_PAN_CLASS));
}
diff --git a/src/lib/elementary/efl_ui_spotlight_util.eo b/src/lib/elementary/efl_ui_spotlight_util.eo
index 0f1335bef0..54b96c280a 100644
--- a/src/lib/elementary/efl_ui_spotlight_util.eo
+++ b/src/lib/elementary/efl_ui_spotlight_util.eo
@@ -1,4 +1,4 @@
-class @beta Efl.Ui.Spotlight.Util {
+abstract @beta Efl.Ui.Spotlight.Util {
methods {
stack_gen @static {
[[Get a preconfigured stack obejct]]
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index 582a3f9027..a5baf5d618 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -23,6 +23,7 @@ static const Efl_Test_Case etc[] = {
{ "efl_ui_relative_container", efl_ui_test_relative_container},
{ "efl_ui_image", efl_ui_test_image},
{ "efl_ui_image_zoomable", efl_ui_test_image_zoomable},
+ { "efl_ui_calendar", efl_ui_test_calendar},
{ "efl_ui_layout", efl_ui_test_layout},
{ "Efl_Ui_Model", efl_ui_model },
{ "efl_ui_widget", efl_ui_test_widget },
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index 9b6a00d8bd..b685c3d684 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -28,6 +28,7 @@ void efl_ui_test_grid(TCase *tc);
void efl_ui_test_relative_container(TCase *tc);
void efl_ui_test_atspi(TCase *tc);
void efl_ui_test_image_zoomable(TCase *tc);
+void efl_ui_test_calendar(TCase *tc);
void efl_ui_test_layout(TCase *tc);
void efl_ui_test_image(TCase *tc);
void efl_ui_test_callback(TCase *tc);
diff --git a/src/tests/elementary/efl_ui_test_calendar.c b/src/tests/elementary/efl_ui_test_calendar.c
new file mode 100644
index 0000000000..b97075f969
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_calendar.c
@@ -0,0 +1,36 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#define EFL_NOLEGACY_API_SUPPORT
+
+#include <Efl_Ui.h>
+#include "efl_ui_suite.h"
+#include "efl_ui_calendar_item.eo.h"
+
+// A day that resolves to no part of the calendar's theme is refused, and the
+// item stays usable without one.
+EFL_START_TEST(efl_ui_calendar_item_without_part)
+{
+ Eo *win, *calendar, *item;
+ Eina_Rect geometry;
+
+ win = win_add(NULL, "calendar", EFL_UI_WIN_TYPE_BASIC);
+ calendar = efl_add(EFL_UI_CALENDAR_CLASS, win);
+ item = efl_add(EFL_UI_CALENDAR_ITEM_CLASS, calendar);
+
+ EXPECT_ERROR_START;
+ efl_ui_calendar_item_day_number_set(item, 9999);
+ EXPECT_ERROR_END;
+
+ geometry = efl_ui_focus_object_focus_geometry_get(item);
+ ck_assert_int_eq(geometry.w, 0);
+ ck_assert_int_eq(geometry.h, 0);
+ efl_ui_focus_object_focus_set(item, EINA_TRUE);
+}
+EFL_END_TEST
+
+void efl_ui_test_calendar(TCase *tc)
+{
+ tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
+ tcase_add_test(tc, efl_ui_calendar_item_without_part);
+}
diff --git a/src/tests/elementary/efl_ui_test_image_zoomable.c b/src/tests/elementary/efl_ui_test_image_zoomable.c
index 5cff2f2ba1..7531a95ab5 100644
--- a/src/tests/elementary/efl_ui_test_image_zoomable.c
+++ b/src/tests/elementary/efl_ui_test_image_zoomable.c
@@ -5,6 +5,7 @@
#include <Efl_Ui.h>
#include "efl_ui_suite.h"
+#include "efl_ui_image_zoomable_pan.eo.h"
EFL_START_TEST(efl_ui_test_image_zoomable_icon)
@@ -121,10 +122,42 @@ EFL_START_TEST(efl_ui_test_image_zoomable_set_while_constructing)
}
EFL_END_TEST
+// A pan is given its widget by its zoomable straight after being created; one
+// made on its own must answer rather than dereference the missing widget.
+EFL_START_TEST(efl_ui_test_image_zoomable_pan_alone)
+{
+ Eo *win, *pan;
+ Eina_Position2D pos;
+ Eina_Size2D sz;
+
+ win = win_add(NULL, "pan", EFL_UI_WIN_TYPE_BASIC);
+ pan = efl_add(EFL_UI_IMAGE_ZOOMABLE_PAN_CLASS, win);
+ ck_assert_ptr_ne(pan, NULL);
+
+ efl_gfx_entity_position_set(pan, EINA_POSITION2D(10, 20));
+ efl_gfx_entity_size_set(pan, EINA_SIZE2D(30, 40));
+ efl_canvas_group_calculate(pan);
+ efl_ui_pan_position_set(pan, EINA_POSITION2D(5, 5));
+
+ pos = efl_ui_pan_position_get(pan);
+ ck_assert_int_eq(pos.x, 0);
+ ck_assert_int_eq(pos.y, 0);
+ pos = efl_ui_pan_position_max_get(pan);
+ ck_assert_int_eq(pos.x, 0);
+ ck_assert_int_eq(pos.y, 0);
+ sz = efl_ui_pan_content_size_get(pan);
+ ck_assert_int_eq(sz.w, 0);
+ ck_assert_int_eq(sz.h, 0);
+
+ efl_del(pan);
+}
+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);
tcase_add_test(tc, efl_ui_test_image_zoomable_set_while_constructing);
+ tcase_add_test(tc, efl_ui_test_image_zoomable_pan_alone);
}
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c
index 2c437241aa..d5e7a37396 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -854,6 +854,20 @@ EFL_START_TEST (efl_ui_spotlight_indicator_ownership)
}
EFL_END_TEST
+// Classes made of static methods only have no instance to be: efl_add() refuses
+// to make one rather than hand back an object that crashes when it is used.
+EFL_START_TEST(efl_ui_spotlight_util_is_abstract)
+{
+ EXPECT_ERROR_START;
+ ck_assert_ptr_eq(efl_add(EFL_UI_SPOTLIGHT_UTIL_CLASS, win), NULL);
+ ck_assert_ptr_eq(efl_add(EFL_UI_FOCUS_UTIL_CLASS, win), NULL);
+ ck_assert_ptr_eq(efl_add(EFL_UI_ACTION_CONNECTOR_CLASS, win), NULL);
+ ck_assert_ptr_eq(efl_add(EFL_UI_VIEW_FACTORY_CLASS, win), NULL);
+ ck_assert_ptr_eq(efl_add(EFL_TEXT_MARKUP_UTIL_CLASS, win), NULL);
+ EXPECT_ERROR_END;
+}
+EFL_END_TEST
+
void efl_ui_test_spotlight(TCase *tc)
{
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
@@ -877,4 +891,5 @@ void efl_ui_test_spotlight(TCase *tc)
tcase_add_test(tc, efl_ui_spotlight_min_max_sizing);
tcase_add_test(tc, efl_ui_spotlight_manager_ownership);
tcase_add_test(tc, efl_ui_spotlight_indicator_ownership);
+ tcase_add_test(tc, efl_ui_spotlight_util_is_abstract);
}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 767e0c5278..4f2e10f1e4 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -148,6 +148,7 @@ efl_ui_suite_src = [
'efl_ui_test_relative_container.c',
'efl_ui_test_image.c',
'efl_ui_test_image_zoomable.c',
+ 'efl_ui_test_calendar.c',
'efl_ui_test_layout.c',
'efl_ui_suite.h',
'efl_ui_model.c',
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.