--- gnome-session-2.28.0/gnome-session/gsm-manager.h.orig	2010-01-21 22:33:17.623433467 +0800
+++ gnome-session-2.28.0/gnome-session/gsm-manager.h	2010-01-21 22:33:55.469179296 +0800
@@ -123,6 +123,7 @@
                                                                 const char     *path);
 
 void                gsm_manager_start                          (GsmManager     *manager);
+void                gsm_manager_end_clients                    (GsmManager     *manager);
 
 
 /* exported methods */
--- gnome-session-2.28.0/gnome-session/main.c.orig	2010-01-21 21:58:56.417898230 +0800
+++ gnome-session-2.28.0/gnome-session/main.c	2010-01-21 22:40:30.068348780 +0800
@@ -329,6 +329,7 @@
            gpointer data)
 {
         int ret;
+        GsmManager *manager;
 
         g_debug ("Got callback for signal %d", signo);
 
@@ -343,6 +344,9 @@
                 break;
         case SIGINT:
         case SIGTERM:
+
+                manager = (GsmManager *)data;
+                gsm_manager_end_clients (manager);
                 /* let the fatal signals interrupt us */
                 g_debug ("Caught signal %d, shutting down normally.", signo);
                 ret = FALSE;
@@ -545,7 +549,6 @@
 
         signal_handler = gdm_signal_handler_new ();
         gdm_signal_handler_add_fatal (signal_handler);
-        gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGFPE, signal_cb, NULL);
         gdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL);
@@ -591,6 +594,7 @@
 
         manager = gsm_manager_new (client_store, failsafe);
 
+        gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, manager);
         gdm_signal_handler_set_fatal_func (signal_handler, shutdown_cb, manager);
 
         if (override_autostart_dirs != NULL) {
--- gnome-session-2.28.0/gnome-session/gsm-manager.c.orig	2010-01-21 22:34:10.305241595 +0800
+++ gnome-session-2.28.0/gnome-session/gsm-manager.c	2010-01-21 23:05:37.171979374 +0800
@@ -720,6 +720,12 @@
         }
 }
 
+void
+gsm_manager_end_clients (GsmManager *manager)
+{
+        do_phase_end_session (manager);
+}
+
 static gboolean
 _client_stop (const char *id,
               GsmClient  *client,
