2007-01-05  Tom Tromey  <tromey@redhat.com>

	Bug #144107:
	* manager.c (update_save_state): Sort save finished list.
	(reverse_priority): New function.

Index: gnome-session/manager.c
===================================================================
--- gnome-session/manager.c	(revision 4182)
+++ gnome-session/manager.c	(working copy)
@@ -534,6 +534,12 @@
   return client_a->priority - client_b->priority;
 }
 
+static gint
+reverse_priority (gconstpointer a, gconstpointer b)
+{
+  return -compare_priority (a, b);
+}
+
 /* Prepare to start clients in order of priority */
 void
 start_clients (GSList* client_list)
@@ -1430,6 +1436,8 @@
 
 	  maybe_write_session ();
 
+	  save_finished_list = g_slist_sort (save_finished_list,
+					     reverse_priority);
 	  for (list = save_finished_list; list;)
 	    {
 	      Client *client = list->data;
