Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > 0ce6e603e7815b2e2d02373d027b07e3 > files > 4

metacity-2.34.13-7.mga5.src.rpm

From 85aba1afe33d973bdea0229b534516c1658a44d5 Mon Sep 17 00:00:00 2001
From: Owen W. Taylor <otaylor@fishsoup.net>
Date: Tue, 25 Jan 2011 13:49:33 +0000
Subject: Should set RestartStyleHint to RestartIfRunning when replaced

This reverts most of commit abbd057eb967e6ab462ffe305f41b2b04d417b25;

 - It's fine to call meta_session_shutdown() after the display
   is closed, since it's talking over the ICE connection
 - We should not call warn_about_lame_clients_and_finish_interact()
   unless we are interacting with the window manager in a session
   save.

However, the part of abbd057 that fixed accessing freed memory was
fixing a real problem; this patches does the same thing in a simpler
way by fixing an obvious type in meta_display_close() where it was
NULL'ing out the local variable 'display' rather than the global
variable 'the_display' and adding keeping the check in meta_finalize()
that was added in abbd057.

The order of calling meta_session_shutdown() and
calling meta_display_close() is reverted back to the old order to
make it clear that it's OK if the display way already closed previously.
---
diff --git a/src/core/display-private.h b/src/core/display-private.h
index cc304c3..feee851 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -330,7 +330,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 e816823..5f20cdf 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -926,7 +926,7 @@ meta_display_close (MetaDisplay *display,
     meta_compositor_destroy (display->compositor);
   
   g_free (display);
-  display = NULL;
+  the_display = NULL;
 
   meta_quit (META_EXIT_SUCCESS);
 }
@@ -4727,9 +4727,6 @@ process_selection_clear (MetaDisplay   *display,
                                     screen,
                                     event->xselectionclear.time);
 
-      if (!display)
-        the_display = NULL;
-
       /* display and screen may both be invalid memory... */
       
       return;
@@ -4751,12 +4748,10 @@ process_selection_clear (MetaDisplay   *display,
 }
 
 void
-meta_display_unmanage_screen (MetaDisplay **displayp,
+meta_display_unmanage_screen (MetaDisplay *display,
                               MetaScreen  *screen,
                               guint32      timestamp)
 {
-  MetaDisplay *display = *displayp;
-
   meta_verbose ("Unmanaging screen %d on display %s\n",
                 screen->number, display->name);
   
@@ -4766,10 +4761,7 @@ meta_display_unmanage_screen (MetaDisplay **displayp,
   display->screens = g_slist_remove (display->screens, screen);
 
   if (display->screens == NULL)
-    {
-      meta_display_close (display, timestamp);
-      *displayp = NULL;
-    }
+    meta_display_close (display, timestamp);
 }
 
 void
diff --git a/src/core/main.c b/src/core/main.c
index 4f74383..ac253bd 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -363,11 +363,11 @@ meta_finalize (void)
 {
   MetaDisplay *display = meta_get_display();
 
-  meta_session_shutdown ();
-
   if (display)
     meta_display_close (display,
                         CurrentTime); /* I doubt correct timestamps matter here */
+
+  meta_session_shutdown ();
 }
 
 static int sigterm_pipe_fds[2] = { -1, -1 };
diff --git a/src/core/session.c b/src/core/session.c
index 2ca15c9..024d88f 100644
--- a/src/core/session.c
+++ b/src/core/session.c
@@ -381,14 +381,6 @@ 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;
   
--
cgit v0.8.3.4