Destroy profile handle when all connection handle is deinitialized
[platform/core/api/connection.git] / src / connection.c
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;