[network-manager-applet/rm-userset] editor: make sure editor signals are cleaned up on dispose
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/rm-userset] editor: make sure editor signals are cleaned up on dispose
- Date: Thu, 3 Feb 2011 02:45:08 +0000 (UTC)
commit 9b21185392b6eb7d559ddc67662d688441cfd721
Author: Dan Williams <dcbw redhat com>
Date: Wed Feb 2 20:37:17 2011 -0600
editor: make sure editor signals are cleaned up on dispose
Otherwise permission updates could happen after the editor was already
destroyed.
src/connection-editor/nm-connection-editor.c | 16 ++++++++++++----
src/connection-editor/nm-connection-editor.h | 3 +++
2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 8b83905..a4fd726 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -314,6 +314,8 @@ dispose (GObject *object)
NMConnectionEditor *editor = NM_CONNECTION_EDITOR (object);
GSList *iter;
+ if (editor->disposed)
+ goto out;
editor->disposed = TRUE;
g_slist_foreach (editor->initializing_pages, (GFunc) g_object_unref, NULL);
@@ -352,6 +354,10 @@ dispose (GObject *object)
editor->builder = NULL;
}
+ g_signal_handler_disconnect (editor->client, editor->permission_id);
+ g_object_unref (editor->client);
+
+out:
G_OBJECT_CLASS (nm_connection_editor_parent_class)->dispose (object);
}
@@ -390,11 +396,13 @@ nm_connection_editor_new (NMConnection *connection,
return NULL;
}
+ editor->client = g_object_ref (client);
+
editor->can_modify = nm_client_get_permission_result (client, NM_CLIENT_PERMISSION_SETTINGS_CONNECTION_MODIFY);
- g_signal_connect (client,
- "permission-changed",
- G_CALLBACK (permissions_changed_cb),
- editor);
+ editor->permission_id = g_signal_connect (editor->client,
+ "permission-changed",
+ G_CALLBACK (permissions_changed_cb),
+ editor);
editor->ok_button = ce_polkit_button_new (_("_Save"),
_("Save any changes made to this connection."),
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index 7cf8548..da6abbb 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -38,6 +38,9 @@ typedef struct {
GObject parent;
gboolean disposed;
+ NMClient *client;
+ guint permission_id;
+
/* private data */
NMConnection *connection;
NMConnection *orig_connection;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]