Remove unnecessary timer 43/194043/1
authorWonnam Jang <wn.jang@samsung.com>
Wed, 28 Nov 2018 10:59:54 +0000 (19:59 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Wed, 28 Nov 2018 10:59:54 +0000 (19:59 +0900)
Change-Id: I6f56f5eda8db76a3cea0d9a055bd0c78a3622ca4
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
client/tts.c

index ac20eb3..f5a44f3 100644 (file)
@@ -638,7 +638,10 @@ static Eina_Bool __tts_connect_daemon(void *data)
                client->utt_id = -1;
 
                ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
-               client->conn_timer = NULL;
+               if (client->conn_timer) {
+                       ecore_timer_del(client->conn_timer);
+                       client->conn_timer = NULL;
+               }
                return EINA_FALSE;
 
        } else if (TTS_ERROR_PERMISSION_DENIED == ret) {
@@ -648,7 +651,10 @@ static Eina_Bool __tts_connect_daemon(void *data)
                client->utt_id = -1;
 
                ecore_timer_add(0, __tts_notify_error, (void*)client->tts);
-               client->conn_timer = NULL;
+               if (client->conn_timer) {
+                       ecore_timer_del(client->conn_timer);
+                       client->conn_timer = NULL;
+               }
                return EINA_FALSE;
 
        } else if (TTS_ERROR_NONE != ret) {
@@ -661,7 +667,10 @@ static Eina_Bool __tts_connect_daemon(void *data)
                SLOG(LOG_ERROR, TAG_TTSC, "Supported options : credential(%s)", credential_needed ? "need" : "no need");
        }
 
-       client->conn_timer = NULL;
+       if (client->conn_timer) {
+               ecore_timer_del(client->conn_timer);
+               client->conn_timer = NULL;
+       }
 
        client = tts_client_get(tts);
        /* check handle */
@@ -711,6 +720,10 @@ int tts_prepare(tts_h tts)
        }
 
        ecore_thread_main_loop_begin();
+       if (client->conn_timer) {
+               ecore_timer_del(client->conn_timer);
+               client->conn_timer = NULL;
+       }
        client->conn_timer = ecore_timer_add(0.02, __tts_connect_daemon, (void*)tts);
        ecore_thread_main_loop_end();