summaryrefslogtreecommitdiff
path: root/src/lib/emotion
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-07-18 19:59:41 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-07-18 20:00:22 +0900
commitf9f0b717e641b651c18109d56968ae97dd37e73a (patch)
treeef3d7435d3b926902af32f2b0491ed207f288d1d /src/lib/emotion
parent525c4cbecebb25f7b939c3a7e47957042862c4ee (diff)
emotion - fix shutdown to ensure all pending async calls are gone too.
Diffstat (limited to 'src/lib/emotion')
-rw-r--r--src/lib/emotion/emotion_main.c39
-rw-r--r--src/lib/emotion/emotion_modules.h4
2 files changed, 33 insertions, 10 deletions
diff --git a/src/lib/emotion/emotion_main.c b/src/lib/emotion/emotion_main.c
index c99a1393fa..23f6c7f05d 100644
--- a/src/lib/emotion/emotion_main.c
+++ b/src/lib/emotion/emotion_main.c
@@ -130,7 +130,6 @@ emotion_object_extension_may_play_get(const char *file)
130 130
131static int _emotion_init_count = 0; 131static int _emotion_init_count = 0;
132 132
133
134EAPI Eina_Bool 133EAPI Eina_Bool
135emotion_init(void) 134emotion_init(void)
136{ 135{
@@ -188,6 +187,20 @@ emotion_init(void)
188 return EINA_FALSE; 187 return EINA_FALSE;
189} 188}
190 189
190static int emotion_pendig_events = 0;
191
192EAPI void
193_emotion_pending_ecore_begin(void)
194{
195 emotion_pendig_events++;
196}
197
198EAPI void
199_emotion_pending_ecore_end(void)
200{
201 emotion_pendig_events--;
202}
203
191EAPI Eina_Bool 204EAPI Eina_Bool
192emotion_shutdown(void) 205emotion_shutdown(void)
193{ 206{
@@ -200,6 +213,21 @@ emotion_shutdown(void)
200 } 213 }
201 if (--_emotion_init_count) return EINA_TRUE; 214 if (--_emotion_init_count) return EINA_TRUE;
202 215
216 start = ecore_time_get();
217 while (((emotion_pending_objects > 0) ||
218 (emotion_pendig_events > 0)) &&
219 ((ecore_time_get() - start) < 0.5))
220 ecore_main_loop_iterate();
221
222 if (emotion_pending_objects > 0)
223 {
224 EINA_LOG_ERR("There is still %i Emotion pipeline running", emotion_pending_objects);
225 }
226 if (emotion_pendig_events > 0)
227 {
228 EINA_LOG_ERR("There is still %i Emotion events queued", emotion_pendig_events);
229 }
230
203 emotion_modules_shutdown(); 231 emotion_modules_shutdown();
204 232
205 emotion_webcam_shutdown(); 233 emotion_webcam_shutdown();
@@ -211,15 +239,6 @@ emotion_shutdown(void)
211 _emotion_config_file = NULL; 239 _emotion_config_file = NULL;
212 } 240 }
213 241
214 start = ecore_time_get();
215 while (emotion_pending_objects && ecore_time_get() - start < 0.5)
216 ecore_main_loop_iterate();
217
218 if (emotion_pending_objects)
219 {
220 EINA_LOG_ERR("There is still %i Emotion pipeline running", emotion_pending_objects);
221 }
222
223 eet_shutdown(); 242 eet_shutdown();
224 ecore_shutdown(); 243 ecore_shutdown();
225 244
diff --git a/src/lib/emotion/emotion_modules.h b/src/lib/emotion/emotion_modules.h
index 0ece2c1d9c..03fb7dbab4 100644
--- a/src/lib/emotion/emotion_modules.h
+++ b/src/lib/emotion/emotion_modules.h
@@ -127,6 +127,10 @@ EAPI void _emotion_image_reset(Evas_Object *obj);
127EAPI void _emotion_pending_object_ref(void); 127EAPI void _emotion_pending_object_ref(void);
128EAPI void _emotion_pending_object_unref(void); 128EAPI void _emotion_pending_object_unref(void);
129 129
130EAPI void _emotion_pending_ecore_begin(void);
131EAPI void _emotion_pending_ecore_end(void);
132
133
130EAPI const char *emotion_webcam_custom_get(const char *device); 134EAPI const char *emotion_webcam_custom_get(const char *device);
131 135
132EAPI Eina_Bool _emotion_module_register(const Emotion_Engine *api); 136EAPI Eina_Bool _emotion_module_register(const Emotion_Engine *api);