Update test codes 39/249839/3 accepted/tizen/unified/20201224.151547 submit/tizen/20201218.042524
authorhj kim <backto.kim@samsung.com>
Thu, 17 Dec 2020 05:08:20 +0000 (14:08 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 17 Dec 2020 05:49:31 +0000 (05:49 +0000)
Destroy client when quit the program

Change-Id: I60c18d185ca7b5e5b9accca09ff82851f6983a12

test/server_test/media_controller_server_test.c

index f1cc7e5..bd1b8c6 100755 (executable)
@@ -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;