[mutter: 15/209] Session must be saved before display close, and display shouldn't close during shutd



commit abbd057eb967e6ab462ffe305f41b2b04d417b25
Author: Thomas James Alexander Thurman <tthurman src gnome org>
Date:   Wed Feb 11 05:26:58 2009 +0000

            Session must be saved before display close, and display
            shouldn't close during shutdown if it's already closed.
            Can't believe we don't have a bug about this already...
    	* src/core/display-private.h:
    	* src/core/display.c:
    	* src/core/main.c:
    	* src/core/session.c:
    
    
    svn path=/trunk/; revision=4133

 ChangeLog                  |   11 +++++++++++
 src/core/display-private.h |    2 +-
 src/core/display.c         |   14 +++++++++++---
 src/core/main.c            |    7 +++++--
 src/core/session.c         |    8 ++++++++
 5 files changed, 36 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a2237b4..09cf1b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-02-11  Thomas Thurman  <tthurman gnome org>
+
+        Session must be saved before display close, and display
+        shouldn't close during shutdown if it's already closed.
+        Can't believe we don't have a bug about this already...
+
+	* src/core/display-private.h:
+	* src/core/display.c:
+	* src/core/main.c:
+	* src/core/session.c:
+
 2009-02-10  Matt Kraai  <kraai ftfbs org>
 
         Don't define meta_spew_event unless verbose mode is on.
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 9c8ebc6..19287f3 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -329,7 +329,7 @@ MetaScreen*   meta_display_screen_for_xwindow  (MetaDisplay *display,
 void          meta_display_grab                (MetaDisplay *display);
 void          meta_display_ungrab              (MetaDisplay *display);
 
-void          meta_display_unmanage_screen     (MetaDisplay *display,
+void          meta_display_unmanage_screen     (MetaDisplay **display,
                                                 MetaScreen  *screen,
                                                 guint32      timestamp);
 
diff --git a/src/core/display.c b/src/core/display.c
index 70b952a..55c374a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -4762,10 +4762,13 @@ process_selection_clear (MetaDisplay   *display,
       meta_verbose ("Got selection clear for screen %d on display %s\n",
                     screen->number, display->name);
       
-      meta_display_unmanage_screen (display, 
+      meta_display_unmanage_screen (&display, 
                                     screen,
                                     event->xselectionclear.time);
 
+      if (!display)
+        the_display = NULL;
+
       /* display and screen may both be invalid memory... */
       
       return;
@@ -4787,10 +4790,12 @@ process_selection_clear (MetaDisplay   *display,
 }
 
 void
-meta_display_unmanage_screen (MetaDisplay *display,
+meta_display_unmanage_screen (MetaDisplay **displayp,
                               MetaScreen  *screen,
                               guint32      timestamp)
 {
+  MetaDisplay *display = *displayp;
+
   meta_verbose ("Unmanaging screen %d on display %s\n",
                 screen->number, display->name);
   
@@ -4800,7 +4805,10 @@ meta_display_unmanage_screen (MetaDisplay *display,
   display->screens = g_slist_remove (display->screens, screen);
 
   if (display->screens == NULL)
-    meta_display_close (display, timestamp);
+    {
+      meta_display_close (display, timestamp);
+      *displayp = NULL;
+    }
 }
 
 void
diff --git a/src/core/main.c b/src/core/main.c
index ede0cbb..6c36f10 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -353,10 +353,13 @@ meta_select_display (gchar *display_name)
 static void
 meta_finalize (void)
 {
-  meta_display_close (meta_get_display (),
-                      CurrentTime); /* I doubt correct timestamps matter here */
+  MetaDisplay *display = meta_get_display();
 
   meta_session_shutdown ();
+
+  if (display)
+    meta_display_close (display,
+                        CurrentTime); /* I doubt correct timestamps matter here */
 }
 
 static void
diff --git a/src/core/session.c b/src/core/session.c
index fc29e13..0707491 100644
--- a/src/core/session.c
+++ b/src/core/session.c
@@ -376,6 +376,14 @@ meta_session_shutdown (void)
   SmProp *props[1];
   char hint = SmRestartIfRunning;
 
+  if (!meta_get_display ())
+    {
+      meta_verbose ("Cannot close session because there is no display");
+      return;
+    }
+
+  warn_about_lame_clients_and_finish_interact (FALSE);
+
   if (session_connection == NULL)
     return;
   



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]