diff --git a/legacy/emotion/ChangeLog b/legacy/emotion/ChangeLog index beb9c64034..ae4b10a2f8 100644 --- a/legacy/emotion/ChangeLog +++ b/legacy/emotion/ChangeLog @@ -25,3 +25,7 @@ 2012-06-19 Cedric Bail * Sync rendering with Ecore_Animator. + +2012-06-03 Cedric Bail + + * Track pending object for proper shutdown. diff --git a/legacy/emotion/NEWS b/legacy/emotion/NEWS index cb4d5af68f..5fffba7213 100644 --- a/legacy/emotion/NEWS +++ b/legacy/emotion/NEWS @@ -7,6 +7,7 @@ Additions: - Add support for "playback_started" callback to generic player. - Implement SPU switch for generic/vlc. - Sync rendering with Ecore_Animator. + - Track pending object for proper shutdown. Fixes: - build out of tree. diff --git a/legacy/emotion/src/bin/emotion_test_main.c b/legacy/emotion/src/bin/emotion_test_main.c index 93c80fd432..80446ac66e 100644 --- a/legacy/emotion/src/bin/emotion_test_main.c +++ b/legacy/emotion/src/bin/emotion_test_main.c @@ -719,6 +719,8 @@ main(int argc, char **argv) evas_font_cache_set(evas, 1 * 1024 * 1024); evas_font_path_append(evas, PACKAGE_DATA_DIR"/data/fonts"); + emotion_init(); + bg_setup(); for (; args < argc; args++) @@ -729,6 +731,8 @@ main(int argc, char **argv) ecore_main_loop_begin(); main_signal_exit(NULL, 0, NULL); + + emotion_shutdown(); ecore_evas_free(ecore_evas); ecore_evas_shutdown(); edje_shutdown(); diff --git a/legacy/emotion/src/lib/emotion_main.c b/legacy/emotion/src/lib/emotion_main.c index 74c6eebbd4..52b1baa597 100644 --- a/legacy/emotion/src/lib/emotion_main.c +++ b/legacy/emotion/src/lib/emotion_main.c @@ -49,6 +49,7 @@ void *alloca (size_t); #include "emotion_private.h" static Emotion_Version _version = { VMAJ, VMIN, VMIC, VREV }; +static int emotion_pending_objects = 0; EAPI Emotion_Version *emotion_version = &_version; EAPI int EMOTION_WEBCAM_UPDATE = 0; @@ -343,6 +344,8 @@ emotion_init(void) if (_emotion_webcams_count++) return EINA_TRUE; + ecore_init(); + snprintf(buffer, 4096, "%s/emotion.cfg", PACKAGE_DATA_DIR); _emotion_webcams_file = eet_open(buffer, EET_FILE_MODE_READ); if (_emotion_webcams_file) @@ -382,6 +385,7 @@ EAPI Eina_Bool emotion_shutdown(void) { Emotion_Webcam *ew; + double start; if (_emotion_webcams_count <= 0) { @@ -415,6 +419,17 @@ emotion_shutdown(void) eeze_shutdown(); #endif + start = ecore_time_get(); + while (emotion_pending_objects && ecore_time_get() - start < 0.5) + ecore_main_loop_iterate(); + + if (emotion_pending_objects) + { + EINA_LOG_ERR("There is still %i Emotion pipeline running", emotion_pending_objects); + } + + ecore_shutdown(); + return EINA_TRUE; } @@ -455,3 +470,15 @@ emotion_webcam_custom_get(const char *device) return NULL; } + +EAPI void +_emotion_pending_object_ref(void) +{ + emotion_pending_objects++; +} + +EAPI void +_emotion_pending_object_unref(void) +{ + emotion_pending_objects--; +} diff --git a/legacy/emotion/src/lib/emotion_private.h b/legacy/emotion/src/lib/emotion_private.h index 4f9458fb34..62801fc7fa 100644 --- a/legacy/emotion/src/lib/emotion_private.h +++ b/legacy/emotion/src/lib/emotion_private.h @@ -128,4 +128,7 @@ EAPI Eina_Bool _emotion_module_unregister(const char *name); EAPI const char *emotion_webcam_custom_get(const char *device); +EAPI void _emotion_pending_object_ref(void); +EAPI void _emotion_pending_object_unref(void); + #endif