} 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);
__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;
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;