Close fd after g_source_remove in free_client 48/107148/1 accepted/tizen/common/20170112.174808 accepted/tizen/ivi/20170112.222951 accepted/tizen/mobile/20170112.222858 accepted/tizen/tv/20170112.222914 accepted/tizen/wearable/20170112.222931 submit/tizen/20170112.062520
authorJiwoong Im <jiwoong.im@samsung.com>
Tue, 27 Dec 2016 02:32:00 +0000 (11:32 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Tue, 27 Dec 2016 02:33:01 +0000 (11:33 +0900)
Change-Id: Ia0d7e9d123cf0f8d518ef6c7ca5187dddfbd9971
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
lib/buxton2.c

index af7f5d4..486c310 100644 (file)
@@ -2356,16 +2356,16 @@ static void free_client(struct buxton_client *cli)
 
        f = g_list_find(clients, cli);
        if (f) {
-               if (cli->fd != -1) {
-                       close(cli->fd);
-                       cli->fd = -1;
-               }
-
                if (cli->fd_id) {
                        g_source_remove(cli->fd_id);
                        cli->fd_id = 0;
                }
 
+               if (cli->fd != -1) {
+                       close(cli->fd);
+                       cli->fd = -1;
+               }
+
                if (cli->st_callback)
                        cli->st_callback(BUXTON_STATUS_DISCONNECTED, cli->st_data);
        }