The attached patch is extracted from the upstream changes between 0.9.8
and 0.9.9 and fixes my problem in seahorse where it enters an endless
loop on quit if I've opened up the key properties dialog while running
seahorse.

Sam: can you please try this one and check if it fixes your problem as
well? Can you test the upstream 0.9.9 and see if that fixes your
problem? 
(0.9.10 seems to need a newer GTK+ version then Debian has for it's
GtkStatusIcon changes)

Jose: Judging from the upstream changlogs for the newer versions there
seems to be many important fixes applied since 0.9.7. You might want to
go through them all and see if anything else should be applied before
Etch is released. (Btw, Why was the development branch put into Etch?)



-- 
Regards,
Andreas Henriksson
diff -urip seahorse-0.9.8/agent/Makefile.am seahorse-0.9.9/agent/Makefile.am
--- seahorse-0.9.8/libseahorse/seahorse-context.c	2006-11-05 19:47:36.000000000 +0100
+++ seahorse-0.9.9/libseahorse/seahorse-context.c	2006-12-10 17:12:03.000000000 +0100
@@ -508,6 +508,7 @@ seahorse_context_take_key (SeahorseConte
     g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
     g_return_if_fail (SEAHORSE_IS_KEY (skey));
     g_return_if_fail (skey->keyid != 0);
+    g_return_if_fail (!skey->attached_to);
     
     ks = hashkey_by_source (seahorse_key_get_source (skey), 
                             seahorse_key_get_keyid (skey));
@@ -515,6 +516,8 @@ seahorse_context_take_key (SeahorseConte
     g_return_if_fail (!g_hash_table_lookup (sctx->pv->keys_by_source, ks));
 
     g_object_ref (skey);
+
+    skey->attached_to = sctx;
     g_hash_table_replace (sctx->pv->keys_by_source, ks, skey);
     setup_keys_by_type (sctx, skey, TRUE);
     g_signal_emit (sctx, signals[ADDED], 0, skey);
@@ -637,6 +640,12 @@ seahorse_context_find_keys_full (Seahors
     return km.keys; 
 }
 
+gboolean
+seahorse_context_owns_key (SeahorseContext *sctx, SeahorseKey *skey)
+{
+    return skey->attached_to == sctx;
+}
+
 void 
 seahorse_context_remove_key (SeahorseContext *sctx, SeahorseKey *skey)
 {
@@ -649,9 +658,12 @@ seahorse_context_remove_key (SeahorseCon
                            seahorse_key_get_keyid (skey));
     
     if (g_hash_table_lookup (sctx->pv->keys_by_source, k)) {
+        g_return_if_fail (skey->attached_to == sctx);
+
         g_object_ref (skey);
         g_signal_handlers_disconnect_by_func (skey, key_changed, sctx);
         g_signal_handlers_disconnect_by_func (skey, key_destroyed, sctx);
+        skey->attached_to = NULL;
         g_hash_table_remove (sctx->pv->keys_by_source, k);
         setup_keys_by_type (sctx, skey, FALSE);
         g_signal_emit (sctx, signals[REMOVED], 0, skey);    
@@ -743,7 +755,7 @@ load_local_keys (SeahorseContext *sctx)
 void
 seahorse_context_load_local_keys_async (SeahorseContext *sctx)
 {
-    g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)load_local_keys, NULL, sctx);
+    g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)load_local_keys, sctx, NULL);
 }
 
 
diff -urip seahorse-0.9.8/libseahorse/seahorse-context.h seahorse-0.9.9/libseahorse/seahorse-context.h
--- seahorse-0.9.8/libseahorse/seahorse-context.h	2006-11-05 19:47:36.000000000 +0100
+++ seahorse-0.9.9/libseahorse/seahorse-context.h	2006-12-10 17:12:03.000000000 +0100
@@ -152,6 +152,9 @@ GList*              seahorse_context_fin
 void                seahorse_context_remove_key         (SeahorseContext    *sctx,
                                                          SeahorseKey        *skey);
 
+gboolean            seahorse_context_owns_key           (SeahorseContext    *sctx,
+                                                         SeahorseKey        *skey);
+
 SeahorseServiceDiscovery*
                     seahorse_context_get_discovery      (SeahorseContext    *sctx);
 
diff -urip seahorse-0.9.8/libseahorse/seahorse-key.h seahorse-0.9.9/libseahorse/seahorse-key.h
--- seahorse-0.9.8/libseahorse/seahorse-key.h	2006-09-13 23:46:41.000000000 +0200
+++ seahorse-0.9.9/libseahorse/seahorse-key.h	2006-12-10 17:12:03.000000000 +0100
@@ -128,6 +128,7 @@ typedef enum {
 
 /* Forward declaration */
 struct _SeahorseKeySource;
+struct _SeahorseContext;
 
 typedef struct _SeahorseKey SeahorseKey;
 typedef struct _SeahorseKeyClass SeahorseKeyClass;
@@ -145,6 +146,9 @@ struct _SeahorseKey {
     SeahorseKeyEType            etype;
     guint                       flags;
     struct _SeahorseKeySource*  sksrc;
+
+    /*< private >*/
+    struct _SeahorseContext*    attached_to;
     struct _SeahorseKey*        preferred;
 };
 
diff -urip seahorse-0.9.8/libseahorse/seahorse-keyset.c seahorse-0.9.9/libseahorse/seahorse-keyset.c
--- seahorse-0.9.8/libseahorse/seahorse-keyset.c	2006-09-14 21:40:52.000000000 +0200
+++ seahorse-0.9.9/libseahorse/seahorse-keyset.c	2006-12-10 17:12:03.000000000 +0100
@@ -46,8 +46,6 @@ struct _SeahorseKeysetPrivate {
 
 G_DEFINE_TYPE (SeahorseKeyset, seahorse_keyset, G_TYPE_OBJECT);
 
-static void key_destroyed (SeahorseKey *skey, SeahorseKeyset *skset);
-
 /* -----------------------------------------------------------------------------
  * INTERNAL 
  */
@@ -60,7 +58,6 @@ remove_update (SeahorseKey *skey, gpoint
     
     g_signal_emit (skset, signals[REMOVED], 0, skey, closure);
     g_signal_emit (skset, signals[SET_CHANGED], 0);
-    g_signal_handlers_disconnect_by_func (skey, key_destroyed, skset);    
     return TRUE;
 }
 
@@ -74,15 +71,12 @@ remove_key  (SeahorseKey *skey, gpointer
     remove_update (skey, closure, skset);
 }
 
-static void
-key_destroyed (SeahorseKey *skey, SeahorseKeyset *skset)
-{
-    remove_key (skey, NULL, skset);
-}
-
 static gboolean
 maybe_add_key (SeahorseKeyset *skset, SeahorseKey *skey)
 {
+    if (!seahorse_context_owns_key (SCTX_APP (), skey))
+        return FALSE;
+
     if (g_hash_table_lookup (skset->pv->keys, skey))
         return FALSE;
     
@@ -90,7 +84,6 @@ maybe_add_key (SeahorseKeyset *skset, Se
         return FALSE;
     
     g_hash_table_replace (skset->pv->keys, skey, GINT_TO_POINTER (TRUE));
-    g_signal_connect (skey, "destroy", G_CALLBACK (key_destroyed), skset);
     g_signal_emit (skset, signals[ADDED], 0, skey);
     g_signal_emit (skset, signals[SET_CHANGED], 0);
     return TRUE;

Reply via email to