Index: gnome-session/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/ChangeLog,v
retrieving revision 1.427
diff -u -r1.427 ChangeLog
--- gnome-session/ChangeLog	30 Aug 2004 13:57:02 -0000	1.427
+++ gnome-session/ChangeLog	2 Sep 2004 02:49:52 -0000
@@ -1,3 +1,14 @@
+2004-09-01  Federico Mena Quintero  <federico@ximian.com>
+
+	Fix #151664:
+
+	* headers.h (Client): Add a purge_timeout_id field.
+
+	* manager.c (start_client): Save the purge_timeout_id when we
+	install the timeout.
+	(free_client): Remove the purge timeout if it exists.
+	(purge): Reset the client->purge_timeout_id to 0.
+
 ==================== 2.7.92 ====================
 
 2004-08-21  Kjartan Maraas  <kmaraas@gnome.org>
Index: gnome-session/headers.h
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/headers.h,v
retrieving revision 1.12
diff -u -r1.12 headers.h
--- gnome-session/headers.h	9 Jun 2003 19:04:52 -0000	1.12
+++ gnome-session/headers.h	2 Sep 2004 02:49:52 -0000
@@ -140,6 +140,9 @@
   /* If the client has been loaded from, or saved to, disk */
   gboolean session_saved;
 
+  /* Purge timeout ID; see start_client() */
+  guint purge_timeout_id;
+
   guint magic;
 } Client;
 
Index: gnome-session/manager.c
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/manager.c,v
retrieving revision 1.78
diff -u -r1.78 manager.c
--- gnome-session/manager.c	25 Feb 2003 08:50:09 -0000	1.78
+++ gnome-session/manager.c	2 Sep 2004 02:49:52 -0000
@@ -318,6 +318,13 @@
 
   if (client->last_discard)
     SmFreeProperty (client->last_discard);
+  client->last_discard = NULL;
+
+  if (client->purge_timeout_id != 0)
+    {
+      gtk_timeout_remove (client->purge_timeout_id);
+      client->purge_timeout_id = 0;
+    }
 
   g_free (client);
 }
@@ -501,6 +508,8 @@
 {
   Client* client = (Client*)data;
 
+  client->purge_timeout_id = 0;
+
   if (g_slist_find (pending_list, client))
     {
       REMOVE (pending_list, client);
@@ -570,7 +579,10 @@
     {
       APPEND (pending_list, client);
       if (purge_delay)
-	gtk_timeout_add (purge_delay, purge, (gpointer)client); 
+	{
+	  g_assert (client->purge_timeout_id == 0);
+	  client->purge_timeout_id = gtk_timeout_add (purge_delay, purge, client);
+	}
     }
   else
     {
