diff -ur gnome-session-2.18.0.orig/gnome-session/save.c gnome-session-2.18.0/gnome-session/save.c
--- gnome-session-2.18.0.orig/gnome-session/save.c	2007-03-12 19:48:31.000000000 +0100
+++ gnome-session-2.18.0/gnome-session/save.c	2007-05-11 16:20:55.000000000 +0200
@@ -679,22 +679,35 @@
 
   for (node = clients; node != NULL; node = node->next)
     {
-      GSList *sl;
       Client *client = node->data;
-
-      for (sl = node->next; sl != NULL; sl = sl->next)
+      GSList *sl, *props = client->properties;
+      
+      /* Only trigger duplicate removal when the current client will
+         be resumed by / through XSMP, see Gnome BZ 341286 comment 12 */
+      if (client->match_rule != MATCH_ID)
+        continue;
+
+      /* Always start from the beginning, as there may be an autostarted
+         client in the list before us */
+      sl = clients;
+      while (sl)
         {
 	  Client *tmp_client = sl->data;
-	  GSList *props, *tmp_props;
-
-	  props = client->properties;
-	  tmp_props = tmp_client->properties;
-
-	  if (compare_restart_command (props, tmp_props))
+	  GSList *tmp_props = tmp_client->properties;
+	  
+	  /* Get the next client before potentially removing the current! */
+	  sl = sl->next;
+	  
+	  /* Remove any autostarted clients matching us */
+	  if ((tmp_client->match_rule == MATCH_PROP) &&
+	      compare_restart_command (props, tmp_props))
 	    {
 	      REMOVE (clients, tmp_client);
 	      free_client (tmp_client);
-	      sl = node;
+	      /* Maybe we should add a break here, so that we only remove max
+	         1 autostarted client, per XSMP restored client. Then when
+	         there are 2 autostarted instances of application foo, and only
+	         one XSMP saved instance of foo, one autostart would remain. */
 	    }
 	}
     }
Only in gnome-session-2.18.0/gnome-session: save.c~
