emotion: avoid crash during shutdown due to Ecore_Event queue.
authorCedric BAIL <cedric@osg.samsung.com>
Fri, 10 Mar 2017 00:17:45 +0000 (16:17 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 10 Mar 2017 00:17:58 +0000 (16:17 -0800)
src/lib/emotion/emotion_webcam.c

index fe3c949..7893e19 100644 (file)
@@ -273,9 +273,12 @@ _emotion_enumerate_all_webcams(void)
 
 Eina_Bool emotion_webcam_init(void)
 {
-   EMOTION_WEBCAM_UPDATE = ecore_event_type_new();
-   EMOTION_WEBCAM_ADD = ecore_event_type_new();
-   EMOTION_WEBCAM_DEL = ecore_event_type_new();
+   if (EMOTION_WEBCAM_UPDATE == 0)
+     {
+        EMOTION_WEBCAM_UPDATE = ecore_event_type_new();
+        EMOTION_WEBCAM_ADD = ecore_event_type_new();
+        EMOTION_WEBCAM_DEL = ecore_event_type_new();
+     }
 
    eet_init();
    _emotion_webcams_edds_new();
@@ -303,10 +306,14 @@ emotion_webcam_shutdown(void)
    Emotion_Webcam *ew;
    const char *syspath;
 
+   ecore_event_type_flush(EMOTION_WEBCAM_UPDATE,
+                          EMOTION_WEBCAM_ADD,
+                          EMOTION_WEBCAM_DEL);
+
    if (_emotion_webcams->idler)
      {
-       ecore_idler_del(_emotion_webcams->idler);
-       _emotion_webcams->idler = NULL;
+        ecore_idler_del(_emotion_webcams->idler);
+        _emotion_webcams->idler = NULL;
      }
 
    EINA_LIST_FREE(_emotion_webcams->check_list, syspath)