seahorse r2492 - in trunk: . libseahorse pgp



Author: nnielsen
Date: Sat Sep 13 15:10:33 2008
New Revision: 2492
URL: http://svn.gnome.org/viewvc/seahorse?rev=2492&view=rev

Log:
	* libseahorse/seahorse-key-widget.c:
	* pgp/seahorse-pgp-key-properties.c: Fix reference problems
	when closing with a PGP properties window open.


Modified:
   trunk/ChangeLog
   trunk/libseahorse/seahorse-key-widget.c
   trunk/pgp/seahorse-pgp-key-properties.c

Modified: trunk/libseahorse/seahorse-key-widget.c
==============================================================================
--- trunk/libseahorse/seahorse-key-widget.c	(original)
+++ trunk/libseahorse/seahorse-key-widget.c	Sat Sep 13 15:10:33 2008
@@ -88,7 +88,7 @@
 	g_object_class_install_property (gobject_class, PROP_KEY,
 		g_param_spec_object ("key",  "Seahorse Key",
 				     "Seahorse Key of this widget",
-				    SEAHORSE_TYPE_KEY, G_PARAM_READWRITE));
+				    SEAHORSE_TYPE_KEY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 	g_object_class_install_property (gobject_class, PROP_INDEX,
 		g_param_spec_uint ("index", "Attribute index",
 				   "Index of attribute in key, 0 being none",
@@ -108,6 +108,7 @@
     skwidget = SEAHORSE_KEY_WIDGET (gobject);
     swidget = SEAHORSE_WIDGET (skwidget);
     
+    g_return_if_fail (SEAHORSE_IS_KEY (skwidget->skey));
     keyid = seahorse_key_get_keyid (skwidget->skey);
     
     /* get widgets hash from types */
@@ -136,8 +137,11 @@
     }
     
     g_signal_handlers_disconnect_by_func (skwidget->skey, seahorse_key_widget_destroyed, skwidget);
-    
+
     G_OBJECT_CLASS (parent_class)->finalize (gobject);
+    
+    g_object_unref (skwidget->skey);
+    skwidget->skey = NULL;
 }
 
 static void
@@ -154,6 +158,7 @@
 		/* Refs key and connects to 'destroy' signal */
 		case PROP_KEY:
 			skwidget->skey = g_value_get_object (value);
+			g_object_ref (skwidget->skey);
 			g_signal_connect_after (skwidget->skey, "destroy",
 				G_CALLBACK (seahorse_key_widget_destroyed), skwidget);
 			break;

Modified: trunk/pgp/seahorse-pgp-key-properties.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-properties.c	(original)
+++ trunk/pgp/seahorse-pgp-key-properties.c	Sat Sep 13 15:10:33 2008
@@ -44,6 +44,11 @@
 
 #define NOTEBOOK "notebook"
 
+/* Forward declarations */
+static void properties_response (GtkDialog *dialog, int response, SeahorseWidget *swidget);
+static void properties_destroyed (GtkObject *object, SeahorseWidget *swidget);
+
+
 static void 
 show_glade_widget (SeahorseWidget *swidget, const gchar *name, gboolean show)
 {
@@ -1829,7 +1834,9 @@
 static void
 key_destroyed (GtkObject *object, SeahorseWidget *swidget)
 {
-    seahorse_widget_destroy (swidget);
+	GtkWidget *widget = seahorse_widget_get_toplevel(swidget);
+	g_signal_handlers_disconnect_by_func (widget, properties_destroyed, swidget); 
+	g_signal_handlers_disconnect_by_func (widget, properties_response, swidget);
 }
 
 static void
@@ -1864,7 +1871,7 @@
     if (swidget == NULL)
         return NULL;
 
-    widget = glade_xml_get_widget (swidget->xml, swidget->name);
+    widget = seahorse_widget_get_toplevel(swidget);
     g_signal_connect (widget, "response", G_CALLBACK (properties_response), swidget);
     g_signal_connect (widget, "destroy", G_CALLBACK (properties_destroyed), swidget);
     g_signal_connect_after (pkey, "changed", G_CALLBACK (key_changed), swidget);



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