Destroy profile handle when all connection handle is deinitialized 86/215786/1 submit/tizen/20191018.005838
authorhyunuk.tak <hyunuk.tak@samsung.com>
Wed, 16 Oct 2019 01:02:44 +0000 (10:02 +0900)
committerhyunuk.tak <hyunuk.tak@samsung.com>
Wed, 16 Oct 2019 01:03:29 +0000 (10:03 +0900)
Change-Id: I79b0ef91e9dd5c6cce5007747219a4f994d7e120
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
include/net_connection_private.h
src/connection.c
src/libnetwork.c

index 1af2a6e..0550e32 100755 (executable)
@@ -136,7 +136,7 @@ typedef struct _connection_handle_s {
 } connection_handle_s;
 
 int _connection_libnet_init(connection_handle_s *conn_handle);
-bool _connection_libnet_deinit(connection_handle_s *conn_handle);
+bool _connection_libnet_deinit(connection_handle_s *conn_handle, bool is_empty);
 void _connection_set_cs_tid(int tid, connection_handle_s *conn_handle);
 void _connection_unset_cs_tid(int tid, connection_handle_s *conn_handle);
 int _connection_libnet_get_metered_state(connection_handle_s *conn_handle, bool* is_metered);
index b90606f..9cc447f 100755 (executable)
@@ -202,9 +202,9 @@ EXPORT_API int connection_destroy(connection_h connection)
        __connection_set_proxy_changed_callback(connection, NULL, NULL);
        __connection_set_internet_state_changed_callback(connection, NULL, NULL);
        __connection_set_ethernet_cable_state_changed_cb(connection, NULL, NULL);
-       _connection_libnet_deinit(connection);
 
        conn_handle_list = g_slist_remove(conn_handle_list, connection);
+       _connection_libnet_deinit(connection, (conn_handle_list == NULL));
 
        g_free(connection);
        connection = NULL;
index 2d60d7c..5100cb7 100755 (executable)
@@ -486,20 +486,22 @@ int _connection_libnet_init(connection_handle_s *conn_handle)
        return NET_ERR_NONE;
 }
 
-bool _connection_libnet_deinit(connection_handle_s *conn_handle)
+bool _connection_libnet_deinit(connection_handle_s *conn_handle, bool is_empty)
 {
        net_deregister_client(conn_handle->network_info_handle);
 
-       if (profile_cb_table) {
-               g_hash_table_destroy(profile_cb_table);
-               profile_cb_table = NULL;
-       }
+       if (is_empty) {
+               if (profile_cb_table) {
+                       g_hash_table_destroy(profile_cb_table);
+                       profile_cb_table = NULL;
+               }
 
-       __libnet_clear_profile_list(&profile_iterator);
+               __libnet_clear_profile_list(&profile_iterator);
 
-       if (prof_handle_list) {
-               g_slist_free_full(prof_handle_list, g_free);
-               prof_handle_list = NULL;
+               if (prof_handle_list) {
+                       g_slist_free_full(prof_handle_list, g_free);
+                       prof_handle_list = NULL;
+               }
        }
 
        return true;