delete timer when vc widget is deinitialized 80/162180/1
authorWonnam Jang <wn.jang@samsung.com>
Wed, 29 Nov 2017 07:35:34 +0000 (16:35 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Wed, 29 Nov 2017 11:00:42 +0000 (11:00 +0000)
Change-Id: I5bce055aedb601d08decfac3136d67e2f063dd4b
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
(cherry picked from commit 0cbf9e60b8594da0711e89b7c21c435381da06bc)

client/vc_widget.c

index 257478f..d6bcc47 100644 (file)
@@ -35,6 +35,9 @@ static Ecore_Event_Handler* g_focus_in_handler = NULL;
 static Ecore_Event_Handler* g_focus_out_handler = NULL;
 
 static Ecore_Timer* g_w_start_timer = NULL;
+static Ecore_Timer* g_w_notify_error_timer = NULL;
+static Ecore_Timer* g_w_notify_state_timer = NULL;
+static Ecore_Timer* g_w_notify_result_timer = NULL;
 
 static int g_daemon_pid = 0;
 
@@ -189,6 +192,28 @@ static void __vc_widget_internal_unprepare(vc_h vc_w)
        return;
 }
 
+static void __vc_widget_delete_timer()
+{
+       SLOG(LOG_DEBUG, TAG_VCW, "@@@ [Widget] timers are deleted");
+       if (NULL != g_w_start_timer) {
+               ecore_timer_del(g_w_start_timer);
+               g_w_start_timer = NULL;
+       }
+       if (NULL != g_w_notify_error_timer) {
+               ecore_timer_del(g_w_notify_error_timer);
+               g_w_notify_error_timer = NULL;
+       }
+       if (NULL != g_w_notify_state_timer) {
+               ecore_timer_del(g_w_notify_state_timer);
+               g_w_notify_state_timer = NULL;
+       }
+       if (NULL != g_w_notify_result_timer) {
+               ecore_timer_del(g_w_notify_result_timer);
+               g_w_notify_result_timer = NULL;
+       }
+       return;
+}
+
 int vc_widget_deinitialize(vc_h vc_w)
 {
        SLOG(LOG_DEBUG, TAG_VCW, "@@@ [Widget] Deinitialize");
@@ -228,6 +253,8 @@ int vc_widget_deinitialize(vc_h vc_w)
                break;
        }
 
+       __vc_widget_delete_timer();
+
        SLOG(LOG_DEBUG, TAG_VCW, "Success: destroy");
 
        if (0 == vc_widget_client_get_count()) {
@@ -298,7 +325,7 @@ static Eina_Bool __vc_widget_connect_daemon(void *data)
                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to initialize : %s", __vc_widget_get_error_code(ret));
 
                vc_widget_client_set_error(vc_w, VC_ERROR_ENGINE_NOT_FOUND);
-               ecore_timer_add(0, __vc_widget_notify_error, vc_w);
+               g_w_notify_error_timer = ecore_timer_add(0, __vc_widget_notify_error, vc_w);
 
                SLOG(LOG_DEBUG, TAG_VCW, "@@@");
                return EINA_FALSE;
@@ -309,7 +336,7 @@ static Eina_Bool __vc_widget_connect_daemon(void *data)
                SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to initialize : %s", __vc_widget_get_error_code(ret));
 
                vc_widget_client_set_error(vc_w, VC_ERROR_TIMED_OUT);
-               ecore_timer_add(0, __vc_widget_notify_error, vc_w);
+               g_w_notify_error_timer = ecore_timer_add(0, __vc_widget_notify_error, vc_w);
 
                SLOG(LOG_DEBUG, TAG_VCW, "@@@");
                return EINA_FALSE;
@@ -335,7 +362,7 @@ static Eina_Bool __vc_widget_connect_daemon(void *data)
        }
 
        vc_widget_client_set_state(vc_w, VC_STATE_READY);
-       ecore_timer_add(0, __vc_widget_notify_state_changed, vc_w);
+       g_w_notify_state_timer = ecore_timer_add(0, __vc_widget_notify_state_changed, vc_w);
 
        SLOG(LOG_DEBUG, TAG_VCW, "@@@");
 
@@ -395,7 +422,7 @@ int vc_widget_unprepare(vc_h vc_w)
        __vc_widget_internal_unprepare(vc_w);
 
        vc_widget_client_set_state(vc_w, VC_STATE_INITIALIZED);
-       ecore_timer_add(0, __vc_widget_notify_state_changed, vc_w);
+       g_w_notify_state_timer = ecore_timer_add(0, __vc_widget_notify_state_changed, vc_w);
 
        SLOG(LOG_DEBUG, TAG_VCW, "@@@");
 
@@ -932,7 +959,7 @@ int __vc_widget_cb_error(int reason, int daemon_pid, char* msg)
                        SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Error reason(%d), msg(%s)", reason, msg);
 
                        vc_widget_client_set_error(vc_w, reason);
-                       ecore_timer_add(0, __vc_widget_notify_error, vc_w);
+                       g_w_notify_error_timer = ecore_timer_add(0, __vc_widget_notify_error, vc_w);
                }
        }
 
@@ -1123,7 +1150,7 @@ static Eina_Bool __vc_widget_notify_result(void *data)
 
 void __vc_widget_cb_result()
 {
-       ecore_timer_add(0, __vc_widget_notify_result, NULL);
+       g_w_notify_result_timer = ecore_timer_add(0, __vc_widget_notify_result, NULL);
 
        return;
 }