2008-02-07 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerPolicy.c - (connection_updated): clear invalid tag when connection gets updated to allow that connection to be tried again - (nm_policy_new): save signal ids so they can be disconnected when the policy is destroyed - (nm_policy_destroy): stop any in-progress state change idle handler, and disconnect all signals from the manager object so that none of the policy functions gets called after the policy is destroyed git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3295 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2008-02-07 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/NetworkManagerPolicy.c
|
||||||
|
- (connection_updated): clear invalid tag when connection gets updated
|
||||||
|
to allow that connection to be tried again
|
||||||
|
- (nm_policy_new): save signal ids so they can be disconnected when
|
||||||
|
the policy is destroyed
|
||||||
|
- (nm_policy_destroy): stop any in-progress state change idle handler,
|
||||||
|
and disconnect all signals from the manager object so that none
|
||||||
|
of the policy functions gets called after the policy is destroyed
|
||||||
|
|
||||||
2008-02-06 Dan Williams <dcbw@redhat.com>
|
2008-02-06 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/nm-manager.c
|
* src/nm-manager.c
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
struct NMPolicy {
|
struct NMPolicy {
|
||||||
NMManager *manager;
|
NMManager *manager;
|
||||||
guint device_state_changed_idle_id;
|
guint device_state_changed_idle_id;
|
||||||
|
GSList *signal_ids;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INVALID_TAG "invalid"
|
#define INVALID_TAG "invalid"
|
||||||
@@ -550,6 +551,9 @@ connection_updated (NMManager *manager,
|
|||||||
{
|
{
|
||||||
NMPolicy *policy = (NMPolicy *) user_data;
|
NMPolicy *policy = (NMPolicy *) user_data;
|
||||||
|
|
||||||
|
/* Clear the invalid tag on the connection if it got updated. */
|
||||||
|
g_object_set_data (G_OBJECT (connection), INVALID_TAG, NULL);
|
||||||
|
|
||||||
schedule_change_check (policy);
|
schedule_change_check (policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,37 +588,46 @@ nm_policy_new (NMManager *manager)
|
|||||||
{
|
{
|
||||||
NMPolicy *policy;
|
NMPolicy *policy;
|
||||||
static gboolean initialized = FALSE;
|
static gboolean initialized = FALSE;
|
||||||
|
gulong id;
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
g_return_val_if_fail (NM_IS_MANAGER (manager), NULL);
|
||||||
g_return_val_if_fail (initialized == FALSE, NULL);
|
g_return_val_if_fail (initialized == FALSE, NULL);
|
||||||
|
|
||||||
policy = g_slice_new (NMPolicy);
|
policy = g_malloc0 (sizeof (NMPolicy));
|
||||||
policy->manager = g_object_ref (manager);
|
policy->manager = g_object_ref (manager);
|
||||||
policy->device_state_changed_idle_id = 0;
|
policy->device_state_changed_idle_id = 0;
|
||||||
|
|
||||||
g_signal_connect (manager, "state-change", G_CALLBACK (global_state_changed), policy);
|
id = g_signal_connect (manager, "state-change",
|
||||||
|
G_CALLBACK (global_state_changed), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
g_signal_connect (manager, "device-added",
|
id = g_signal_connect (manager, "device-added",
|
||||||
G_CALLBACK (device_added), policy);
|
G_CALLBACK (device_added), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
g_signal_connect (manager, "device-removed",
|
id = g_signal_connect (manager, "device-removed",
|
||||||
G_CALLBACK (device_removed), policy);
|
G_CALLBACK (device_removed), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
/* Large batch of connections added, manager doesn't want us to
|
/* Large batch of connections added, manager doesn't want us to
|
||||||
* process each one individually.
|
* process each one individually.
|
||||||
*/
|
*/
|
||||||
g_signal_connect (manager, "connections-added",
|
id = g_signal_connect (manager, "connections-added",
|
||||||
G_CALLBACK (connections_added), policy);
|
G_CALLBACK (connections_added), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
/* Single connection added */
|
/* Single connection added */
|
||||||
g_signal_connect (manager, "connection-added",
|
id = g_signal_connect (manager, "connection-added",
|
||||||
G_CALLBACK (connection_added), policy);
|
G_CALLBACK (connection_added), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
g_signal_connect (manager, "connection-updated",
|
id = g_signal_connect (manager, "connection-updated",
|
||||||
G_CALLBACK (connection_updated), policy);
|
G_CALLBACK (connection_updated), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
g_signal_connect (manager, "connection-removed",
|
id = g_signal_connect (manager, "connection-removed",
|
||||||
G_CALLBACK (connection_removed), policy);
|
G_CALLBACK (connection_removed), policy);
|
||||||
|
policy->signal_ids = g_slist_append (policy->signal_ids, (gpointer) id);
|
||||||
|
|
||||||
return policy;
|
return policy;
|
||||||
}
|
}
|
||||||
@@ -622,9 +635,20 @@ nm_policy_new (NMManager *manager)
|
|||||||
void
|
void
|
||||||
nm_policy_destroy (NMPolicy *policy)
|
nm_policy_destroy (NMPolicy *policy)
|
||||||
{
|
{
|
||||||
if (policy) {
|
GSList *iter;
|
||||||
g_object_unref (policy->manager);
|
|
||||||
g_slice_free (NMPolicy, policy);
|
g_return_if_fail (policy != NULL);
|
||||||
|
|
||||||
|
if (policy->device_state_changed_idle_id) {
|
||||||
|
g_source_remove (policy->device_state_changed_idle_id);
|
||||||
|
policy->device_state_changed_idle_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (iter = policy->signal_ids; iter; iter = g_slist_next (iter))
|
||||||
|
g_signal_handler_disconnect (policy->manager, (gulong) iter->data);
|
||||||
|
g_slist_free (policy->signal_ids);
|
||||||
|
|
||||||
|
g_object_unref (policy->manager);
|
||||||
|
g_free (policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user