Index: gnome-session/save.c
===================================================================
--- gnome-session/save.c	(Revision 4168)
+++ gnome-session/save.c	(Arbeitskopie)
@@ -829,7 +829,11 @@ free_session (Session* session)
 {
   while (session->client_list)
     {
-      Client *client1 = (Client*)session->client_list->data;
+      /* we remove the clients first that were started last.
+       * This ensures that WMs, daemons etc. that were started first will
+       * be freed last.
+       */
+      Client *client1 = (Client*)g_list_last (session->client_list)->data;
       REMOVE (session->client_list, client1);
       free_client (client1);		  
     }	      
