From: Suyeon Hwang Date: Tue, 4 Apr 2023 09:16:17 +0000 (+0900) Subject: Unregister TIDL stub port when connection is closed X-Git-Tag: accepted/tizen/unified/20230407.140022~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3da5984f05918108d467f56f3eba214e4e1f7260;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Unregister TIDL stub port when connection is closed - Issue: Connected event callback is invoked even though the connection is closed. - Solution: Previous code does not invoke unregister method of TIDL stub, so the connection callback still can be invoked even if the client succeeds to deinitialize. And this is no intended behavior, so this patch fixes this behaivor. Through this patch, widget module will properly call unregister method. And also, widget module will check first if the stub information is valid. Change-Id: I1864824237218468b5341eb32c23c17e9f278651 Signed-off-by: Suyeon Hwang --- diff --git a/client/vc_widget_tidl.c b/client/vc_widget_tidl.c index b099088..55b2e09 100644 --- a/client/vc_widget_tidl.c +++ b/client/vc_widget_tidl.c @@ -197,6 +197,8 @@ static rpc_port_proxy_vc_widget_proxy_vc_widget_h __create_rpc_port(const char* static void __vcd_widget_create_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, void *user_data) { + RETM_IF(NULL == g_stub_tidl_info, TAG_VCW, "[ERROR] Fail to get tidl stub info"); + g_stub_tidl_info->connected = true; g_stub_tidl_info->register_callback_requesting = false; @@ -216,6 +218,8 @@ static void __vcd_widget_create_cb(rpc_port_stub_vc_widget_stub_vcd_widget_conte static void __vcd_widget_terminate_cb(rpc_port_stub_vc_widget_stub_vcd_widget_context_h context, void *user_data) { + RETM_IF(NULL == g_stub_tidl_info, TAG_VCW, "[ERROR] Fail to get tidl stub info"); + g_stub_tidl_info->connected = false; g_stub_tidl_info->register_callback_requesting = false; @@ -243,6 +247,8 @@ static int __vcd_widget_asr_result_cb(rpc_port_stub_vc_widget_stub_vcd_widget_co static void __register_stub_callback() { + RETM_IF(NULL == g_stub_tidl_info, TAG_VCW, "[TIDL ERROR] g_stub_tidl_info is not allocated"); + if (g_stub_tidl_info->register_callback_requesting) { return; } @@ -344,6 +350,12 @@ int vc_widget_tidl_close_connection() free(g_proxy_tidl_info); g_proxy_tidl_info = NULL; + if (0 != rpc_port_stub_vc_widget_stub_vcd_widget_unregister()) { + SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Fail to unregister stub"); + pthread_mutex_unlock(&g_w_tidl_mutex); + return VC_ERROR_OPERATION_FAILED; + } + free(g_stub_tidl_info); g_stub_tidl_info = NULL;