emotion: add infra to properly track pending object on shutdown.

SVN revision: 73176
This commit is contained in:
Cedric BAIL 2012-07-03 01:58:13 +00:00
parent 10b93e5e1e
commit ebdc0f07a1
5 changed files with 39 additions and 0 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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();

View File

@ -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--;
}

View File

@ -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