| 1 |
From a3de65d5d1861f755ced7cad291fbbd4f1b8ef51 Mon Sep 17 00:00:00 2001
|
| 2 |
From: Owen W. Taylor <otaylor@fishsoup.net>
|
| 3 |
Date: Sat, 22 Aug 2009 15:00:57 -0400
|
| 4 |
Subject: [PATCH] Should set RestartStyleHint to RestartIfRunning when replaced
|
| 5 |
|
| 6 |
This reverts most of commit abbd057eb967e6ab462ffe305f41b2b04d417b25;
|
| 7 |
|
| 8 |
- It's fine to call meta_session_shutdown() after the display
|
| 9 |
is closed, since it's talking over the ICE connection
|
| 10 |
- We should not call warn_about_lame_clients_and_finish_interact()
|
| 11 |
unless we are interacting with the window manager in a session
|
| 12 |
save.
|
| 13 |
|
| 14 |
However, the part of abbd057 that fixed accessing freed memory was
|
| 15 |
fixing a real problem; this patches does the same thing in a simpler
|
| 16 |
way by fixing an obvious type in meta_display_close() where it was
|
| 17 |
NULL'ing out the local variable 'display' rather than the global
|
| 18 |
variable 'the_display' and adding keeping the check in meta_finalize()
|
| 19 |
that was added in abbd057.
|
| 20 |
|
| 21 |
The order of calling meta_session_shutdown() and
|
| 22 |
calling meta_display_close() is reverted back to the old order to
|
| 23 |
make it clear that it's OK if the display way already closed previously.
|
| 24 |
|
| 25 |
http://bugzilla.gnome.org/show_bug.cgi?id=588119
|
| 26 |
---
|
| 27 |
src/core/display-private.h | 2 +-
|
| 28 |
src/core/display.c | 16 ++++------------
|
| 29 |
src/core/main.c | 5 ++---
|
| 30 |
src/core/session.c | 8 --------
|
| 31 |
4 files changed, 7 insertions(+), 24 deletions(-)
|
| 32 |
|
| 33 |
diff --git a/src/core/display-private.h b/src/core/display-private.h
|
| 34 |
index 19287f3..9c8ebc6 100644
|
| 35 |
--- a/src/core/display-private.h
|
| 36 |
+++ b/src/core/display-private.h
|
| 37 |
@@ -329,7 +329,7 @@ MetaScreen* meta_display_screen_for_xwindow (MetaDisplay *display,
|
| 38 |
void meta_display_grab (MetaDisplay *display);
|
| 39 |
void meta_display_ungrab (MetaDisplay *display);
|
| 40 |
|
| 41 |
-void meta_display_unmanage_screen (MetaDisplay **display,
|
| 42 |
+void meta_display_unmanage_screen (MetaDisplay *display,
|
| 43 |
MetaScreen *screen,
|
| 44 |
guint32 timestamp);
|
| 45 |
|
| 46 |
diff --git a/src/core/display.c b/src/core/display.c
|
| 47 |
index 55c374a..8e35a35 100644
|
| 48 |
--- a/src/core/display.c
|
| 49 |
+++ b/src/core/display.c
|
| 50 |
@@ -926,7 +926,7 @@ meta_display_close (MetaDisplay *display,
|
| 51 |
meta_compositor_destroy (display->compositor);
|
| 52 |
|
| 53 |
g_free (display);
|
| 54 |
- display = NULL;
|
| 55 |
+ the_display = NULL;
|
| 56 |
|
| 57 |
meta_quit (META_EXIT_SUCCESS);
|
| 58 |
}
|
| 59 |
@@ -4762,13 +4762,10 @@ process_selection_clear (MetaDisplay *display,
|
| 60 |
meta_verbose ("Got selection clear for screen %d on display %s\n",
|
| 61 |
screen->number, display->name);
|
| 62 |
|
| 63 |
- meta_display_unmanage_screen (&display,
|
| 64 |
+ meta_display_unmanage_screen (display,
|
| 65 |
screen,
|
| 66 |
event->xselectionclear.time);
|
| 67 |
|
| 68 |
- if (!display)
|
| 69 |
- the_display = NULL;
|
| 70 |
-
|
| 71 |
/* display and screen may both be invalid memory... */
|
| 72 |
|
| 73 |
return;
|
| 74 |
@@ -4790,12 +4787,10 @@ process_selection_clear (MetaDisplay *display,
|
| 75 |
}
|
| 76 |
|
| 77 |
void
|
| 78 |
-meta_display_unmanage_screen (MetaDisplay **displayp,
|
| 79 |
+meta_display_unmanage_screen (MetaDisplay *display,
|
| 80 |
MetaScreen *screen,
|
| 81 |
guint32 timestamp)
|
| 82 |
{
|
| 83 |
- MetaDisplay *display = *displayp;
|
| 84 |
-
|
| 85 |
meta_verbose ("Unmanaging screen %d on display %s\n",
|
| 86 |
screen->number, display->name);
|
| 87 |
|
| 88 |
@@ -4805,10 +4800,7 @@ meta_display_unmanage_screen (MetaDisplay **displayp,
|
| 89 |
display->screens = g_slist_remove (display->screens, screen);
|
| 90 |
|
| 91 |
if (display->screens == NULL)
|
| 92 |
- {
|
| 93 |
- meta_display_close (display, timestamp);
|
| 94 |
- *displayp = NULL;
|
| 95 |
- }
|
| 96 |
+ meta_display_close (display, timestamp);
|
| 97 |
}
|
| 98 |
|
| 99 |
void
|
| 100 |
diff --git a/src/core/main.c b/src/core/main.c
|
| 101 |
index a36a396..44d317e 100644
|
| 102 |
--- a/src/core/main.c
|
| 103 |
+++ b/src/core/main.c
|
| 104 |
@@ -361,12 +361,11 @@ static void
|
| 105 |
meta_finalize (void)
|
| 106 |
{
|
| 107 |
MetaDisplay *display = meta_get_display();
|
| 108 |
-
|
| 109 |
- meta_session_shutdown ();
|
| 110 |
-
|
| 111 |
if (display)
|
| 112 |
meta_display_close (display,
|
| 113 |
CurrentTime); /* I doubt correct timestamps matter here */
|
| 114 |
+
|
| 115 |
+ meta_session_shutdown ();
|
| 116 |
}
|
| 117 |
|
| 118 |
static void
|
| 119 |
diff --git a/src/core/session.c b/src/core/session.c
|
| 120 |
index 7e3b389..0d69350 100644
|
| 121 |
--- a/src/core/session.c
|
| 122 |
+++ b/src/core/session.c
|
| 123 |
@@ -376,14 +376,6 @@ meta_session_shutdown (void)
|
| 124 |
SmProp *props[1];
|
| 125 |
char hint = SmRestartIfRunning;
|
| 126 |
|
| 127 |
- if (!meta_get_display ())
|
| 128 |
- {
|
| 129 |
- meta_verbose ("Cannot close session because there is no display");
|
| 130 |
- return;
|
| 131 |
- }
|
| 132 |
-
|
| 133 |
- warn_about_lame_clients_and_finish_interact (FALSE);
|
| 134 |
-
|
| 135 |
if (session_connection == NULL)
|
| 136 |
return;
|
| 137 |
|
| 138 |
--
|
| 139 |
1.6.4
|
| 140 |
|