[network-manager-applet/NETWORKMANAGER_APPLET_0_7] Make dispose implemention multi-invocation safe



commit 9f5b686a0ef8be3c21d8e6e77938808f03a9aed8
Author: Christian Persch <chpe gnome org>
Date:   Wed May 27 15:15:59 2009 +0200

    Make dispose implemention multi-invocation safe
    
    Dispose can run multiple times.
---
 src/connection-editor/nm-connection-editor.c |   31 +++++++++++++++++--------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 1f9e41c..c695c03 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -374,20 +374,31 @@ dispose (GObject *object)
 {
 	NMConnectionEditor *editor = NM_CONNECTION_EDITOR (object);
 
-	gtk_widget_hide (GTK_WIDGET (editor->window));
-
 	g_slist_foreach (editor->pages, (GFunc) g_object_unref, NULL);
 	g_slist_free (editor->pages);
 	editor->pages = NULL;
 
-	if (editor->connection)
-		g_object_unref (editor->connection);
-
-	gtk_widget_destroy (editor->window);
-	g_object_unref (editor->xml);
-
-	polkit_action_unref (editor->system_action);
-	g_object_unref (editor->system_gnome_action);
+	if (editor->connection) {
+                g_object_unref (editor->connection);
+                editor->connection = NULL;
+        }
+        if (editor->window) {
+                gtk_widget_destroy (editor->window);
+                editor->window = NULL;
+        }
+        if (editor->xml) {
+                g_object_unref (editor->xml);
+                editor->xml = NULL;
+        }
+
+        if (editor->system_action) {
+                polkit_action_unref (editor->system_action);
+                editor->system_action = NULL;
+        }
+        if (editor->system_gnome_action) {
+                g_object_unref (editor->system_gnome_action);
+                editor->system_gnome_action = NULL;
+        }
 
 	G_OBJECT_CLASS (nm_connection_editor_parent_class)->dispose (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]