From: Suyeon Hwang Date: Tue, 23 Aug 2022 02:30:17 +0000 (+0900) Subject: Add new flag variable for checking state X-Git-Tag: submit/tizen/20220823.092009~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c8c344ed22f7bef17ac574b35f652458b02c4ee;p=platform%2Fcore%2Fuifw%2Ftts.git Add new flag variable for checking state - Issue: The engine did not call ttse_main(), but the engine library works like that ttse_main() was already invoked. - Solution: The APIs provided by engine library checks g_is_terminate flag variable for checking whether ttse_main() is invoked or not. However, g_is_terminate variable is for checking whether ttse_terminate() is invoked not for checking ttse_main() invocation. So even if the engine does not call ttse_main(), the library could not know that ttse_main() was not invoked yet. Thus, this patch adds new flag variable for ttse_main() invocation. Change-Id: I82e1df3abe2f685b19a6cd5a85c84c21d28d9624 Signed-off-by: Suyeon Hwang --- diff --git a/server/ttse.c b/server/ttse.c index 729f4dae..ff5415c1 100755 --- a/server/ttse.c +++ b/server/ttse.c @@ -30,6 +30,7 @@ static int g_feature_enabled = -1; static bool g_is_terminated = false; +static bool g_is_started = false; const char* tts_tag() @@ -156,6 +157,8 @@ int ttse_main(int argc, char** argv, ttse_request_callback_s *callback) /* Register vconfkey callback to detect engine change */ vconf_notify_key_changed(TTS_ENGINE_DB_DEFAULT, __engine_changed_cb, NULL); + g_is_started = true; + SLOG(LOG_DEBUG, tts_tag(), "@@@"); return TTSE_ERROR_NONE; @@ -178,6 +181,7 @@ int ttse_terminate(void) vconf_ignore_key_changed(TTS_ENGINE_DB_DEFAULT, __engine_changed_cb); g_is_terminated = true; + g_is_started = false; return TTSE_ERROR_NONE; } @@ -282,8 +286,8 @@ int ttse_get_activated_mode(int* activated_mode) return TTSE_ERROR_INVALID_PARAMETER; } - if (g_is_terminated) { - SLOG(LOG_ERROR, tts_tag(), "[ERROR] Service engine is terminated."); + if (false == g_is_started) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Service engine is not started."); return TTSE_ERROR_INVALID_STATE; } @@ -306,8 +310,8 @@ int ttse_set_activated_mode_changed_cb(ttse_activated_mode_changed_cb callback) return TTSE_ERROR_INVALID_PARAMETER; } - if (g_is_terminated) { - SLOG(LOG_ERROR, tts_tag(), "[ERROR] Service engine is terminated."); + if (false == g_is_started) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Service engine is not started."); return TTSE_ERROR_INVALID_STATE; }