Call ttse_terminate when engine is changed before registering vconfkey callback 79/267579/1
authorsooyeon <sooyeon.kim@samsung.com>
Tue, 7 Dec 2021 17:58:57 +0000 (02:58 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Tue, 7 Dec 2021 17:58:57 +0000 (02:58 +0900)
Change-Id: I92785e18c480154f4802500c759ff725c8d116b6
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
server/ttse.c

index 69489ca..b084099 100755 (executable)
@@ -194,6 +194,13 @@ int ttse_main(int argc, char** argv, ttse_request_callback_s *callback)
                SLOG(LOG_WARN, tts_tag(), "[WARNING] Fail to initialize network");
        }
 
+       /* If a new TTS engine is different from the current engine, call ttse_terminate() */
+       if (FALSE == __is_default_engine()) {
+               SLOG(LOG_WARN, tts_tag(), "[WARNING] TTS engine is changed. Please call ttse_terminate()");
+               ttse_terminate();
+               return TTSE_ERROR_NONE;
+       }
+
        /* Register vconfkey callback to detect engine change */
        vconf_notify_key_changed(TTS_ENGINE_DB_DEFAULT, __engine_changed_cb, NULL);