From 1178a3881510ba16d37a5f2cd045c226c727bf50 Mon Sep 17 00:00:00 2001 From: hj kim Date: Thu, 17 Dec 2020 14:08:20 +0900 Subject: [PATCH] Update test codes Destroy client when quit the program Change-Id: I60c18d185ca7b5e5b9accca09ff82851f6983a12 --- test/server_test/media_controller_server_test.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/server_test/media_controller_server_test.c b/test/server_test/media_controller_server_test.c index f1cc7e5..bd1b8c6 100755 --- a/test/server_test/media_controller_server_test.c +++ b/test/server_test/media_controller_server_test.c @@ -88,15 +88,27 @@ static int g_menu_send_event = 0; | LOCAL FUNCTION PROTOTYPES: | ---------------------------------------------------------------------------*/ +static void __destroy_client(void) +{ + int ret = MEDIA_CONTROLLER_ERROR_NONE; + + ret = mc_client_destroy(g_mc_client); + if (ret != MEDIA_CONTROLLER_ERROR_NONE) + mc_error("Fail to mc_client_destroy"); + + g_mc_client = NULL; +} + static void __mc_server_state_updated_cb(const char *server_name, mc_server_state_e state, void *user_data) { g_server_name = g_strdup(server_name); mc_debug("Server[%s] Server state(%d)", server_name, state); - mc_client_destroy(g_mc_client); + if (g_mc_client) + __destroy_client(); } -static void __create_client() +static void __create_client(void) { int ret = MEDIA_CONTROLLER_ERROR_NONE; @@ -960,6 +972,9 @@ static void __quit(void) g_free(g_server_name); g_server_name = NULL; + if (g_mc_client) + __destroy_client(); + g_main_loop_quit(mainloop); return; -- 2.7.4