2007-10-06 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerPolicy.c
		- (nm_policy_auto_get_best_device): fix connection list reffing.  Each
			connection in the list returned by nm_manager_get_connections() is
			reffed, but they weren't getting unreffed before returning



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2949 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2007-10-06 13:35:28 +00:00
parent 305d49b073
commit 9e866f733f
2 changed files with 17 additions and 8 deletions

View file

@ -1,3 +1,10 @@
2007-10-06 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerPolicy.c
- (nm_policy_auto_get_best_device): fix connection list reffing. Each
connection in the list returned by nm_manager_get_connections() is
reffed, but they weren't getting unreffed before returning
2007-10-06 Dan Williams <dcbw@redhat.com>
* src/nm-manager.c

View file

@ -151,11 +151,9 @@ nm_policy_auto_get_best_device (NMPolicy *policy,
}
}
g_slist_free (connections);
if (best_wired_dev) {
highest_priority_dev = NM_DEVICE (best_wired_dev);
*connection = best_wired_connection;
*connection = g_object_ref (best_wired_connection);
*specific_object = best_wired_specific_object;
} else if (best_wireless_dev) {
gboolean can_activate;
@ -163,11 +161,14 @@ nm_policy_auto_get_best_device (NMPolicy *policy,
can_activate = nm_device_802_11_wireless_can_activate (best_wireless_dev);
if (can_activate) {
highest_priority_dev = NM_DEVICE (best_wireless_dev);
*connection = best_wireless_connection;
*connection = g_object_ref (best_wireless_connection);
*specific_object = best_wireless_specific_object;
}
}
g_slist_foreach (connections, (GFunc) g_object_unref, NULL);
g_slist_free (connections);
if (FALSE) {
char * con_name = g_strdup ("(none)");
@ -334,16 +335,17 @@ nm_policy_device_change_check (gpointer user_data)
}
if (do_switch) {
if (old_dev) {
// FIXME: remove old_dev deactivation when multiple device support lands
if (old_dev)
nm_device_interface_deactivate (NM_DEVICE_INTERFACE (old_dev));
}
if (new_dev) {
if (new_dev)
nm_manager_activate_device (policy->manager, new_dev, connection, specific_object, FALSE);
}
}
out:
if (connection)
g_object_unref (connection);
return FALSE;
}