From: hyunuk.tak Date: Wed, 16 Oct 2019 01:02:44 +0000 (+0900) Subject: Destroy profile handle when all connection handle is deinitialized X-Git-Tag: submit/tizen/20191018.005838^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F215786%2F1;p=platform%2Fcore%2Fapi%2Fconnection.git Destroy profile handle when all connection handle is deinitialized Change-Id: I79b0ef91e9dd5c6cce5007747219a4f994d7e120 Signed-off-by: hyunuk.tak --- diff --git a/include/net_connection_private.h b/include/net_connection_private.h index 1af2a6e..0550e32 100755 --- a/include/net_connection_private.h +++ b/include/net_connection_private.h @@ -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); diff --git a/src/connection.c b/src/connection.c index b90606f..9cc447f 100755 --- a/src/connection.c +++ b/src/connection.c @@ -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; diff --git a/src/libnetwork.c b/src/libnetwork.c index 2d60d7c..5100cb7 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -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;