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 a56cd9f7b6ad4899ffb4e6bdde78abab878ccc8d
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 8 15:27:48 2026 -0600

    emotion: load an engine module once, not for every video
    
    emotion_engine_instance_new() called eina_module_load() for
    the requested module on every object it made. A load counts, and
    emotion_modules_shutdown() lets go of the module once, so a life of
    emotion with two videos left the module loaded and its init count at
    one: the module was never told to unregister, and the registry was
    emptied under it. The next life of emotion (Elementary shut down and
    started again) loaded it again, the module saw its count and returned
    without registering, and the next video found no engine ("Couldn't
    find requested engine: gstreamer1", then "No engine worked"). Load it
    only when the engine is not registered, and not at all when the module
    is not there (eina_module_load(NULL) logged for it).
    
    The test makes two videos, restarts Elementary and makes a third one.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/emotion/emotion_modules.c     |  8 ++++++--
 src/tests/elementary/elm_test_video.c | 22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/lib/emotion/emotion_modules.c b/src/lib/emotion/emotion_modules.c
index 0662556868..3bd0dbc71b 100644
--- a/src/lib/emotion/emotion_modules.c
+++ b/src/lib/emotion/emotion_modules.c
@@ -353,7 +353,11 @@ emotion_engine_instance_new(const char *name, Evas_Object *obj, Emotion_Module_O
      }
 
 
-   if (name)
+   // A module is loaded when its engine is not registered yet, and not for every
+   // object made: loading counts, the shutdown lets go once, and a module that
+   // stays loaded believes itself registered in a registry that was emptied
+   // (the next life of emotion would find no engine).
+   if (name && !_emotion_engine_registry_find(name))
      {
         m = _find_mod(name);
         if (m)
@@ -366,7 +370,7 @@ emotion_engine_instance_new(const char *name, Evas_Object *obj, Emotion_Module_O
    if (!_emotion_engine_registry)
      {
         m = _find_mod("gstreamer1");
-        if (!eina_module_load(m))
+        if (m && !eina_module_load(m))
           ERR("Cannot load module %s", eina_module_file_get(m));
      }
 
diff --git a/src/tests/elementary/elm_test_video.c b/src/tests/elementary/elm_test_video.c
index 970908dffd..89ecd503b9 100644
--- a/src/tests/elementary/elm_test_video.c
+++ b/src/tests/elementary/elm_test_video.c
@@ -43,8 +43,30 @@ EFL_START_TEST(elm_atspi_role_get)
 EFL_END_TEST
 */
 
+/* Emotion goes down with Elementary and comes back with it: the engine has to
+   be there the second time, after two videos in the first life. */
+EFL_START_TEST(elm_video_engine_after_shutdown)
+{
+   Evas_Object *win;
+
+   win = win_add(NULL, "video", ELM_WIN_BASIC);
+   ck_assert(elm_video_add(win) != NULL);
+   ck_assert(elm_video_add(win) != NULL);
+
+   elm_shutdown();
+   elm_init(0, NULL);
+
+   // win_add() would hand back the window of the first life
+   fail_on_errors_setup();
+   win = elm_win_add(NULL, "video", ELM_WIN_BASIC);
+   ck_assert(elm_video_add(win) != NULL);
+   fail_on_errors_teardown();
+}
+EFL_END_TEST
+
 void elm_test_video(TCase *tc)
 {
    tcase_add_test(tc, elm_video_legacy_type_check);
+   tcase_add_test(tc, elm_video_engine_after_shutdown);
 //   tcase_add_test(tc, elm_atspi_role_get);
 }

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

Reply via email to