diff options
author | Dan Williams <dcbw@redhat.com> | 2007-10-06 13:35:28 +0000 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2007-10-06 13:35:28 +0000 |
commit | 9e866f733f1e28ac6f67e80e6415dbcd6ab0746d (patch) | |
tree | 49bd61547e3828f248e50bb8d1c0d65dc03b313b | |
parent | 305d49b073e0f2e4891554ffbc726de3f4b92268 (diff) | |
download | NetworkManager-9e866f733f1e28ac6f67e80e6415dbcd6ab0746d.tar.gz |
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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/NetworkManagerPolicy.c | 18 |
2 files changed, 17 insertions, 8 deletions
@@ -1,5 +1,12 @@ 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 - (connections_to_slist): sort connections first on autoconnect, then on timestamp diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index dbc925a9d7..dc3601b1b9 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -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; } |