[mutter] events: Return early if we close the display
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] events: Return early if we close the display
- Date: Sun, 13 Jul 2014 15:47:33 +0000 (UTC)
commit 46361c3e289a5ba190182ec0a77b0850064f2e2c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Jul 13 11:42:37 2014 -0400
events: Return early if we close the display
This is so we won't poke into the MetaDisplay, which is invalid memory,
and crash. This can sometimes work right now because GSlice might not
deallocate the object immediately, but it's still not a fun thing to do.
src/x11/events.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/x11/events.c b/src/x11/events.c
index 7355714..e031c0a 100644
--- a/src/x11/events.c
+++ b/src/x11/events.c
@@ -1148,7 +1148,7 @@ process_selection_request (MetaDisplay *display,
meta_verbose ("Handled selection request\n");
}
-static void
+static gboolean
process_selection_clear (MetaDisplay *display,
XEvent *event)
{
@@ -1169,7 +1169,7 @@ process_selection_clear (MetaDisplay *display,
meta_XFree (str);
- return;
+ return FALSE;
}
meta_verbose ("Got selection clear for screen %d on display %s\n",
@@ -1177,6 +1177,7 @@ process_selection_clear (MetaDisplay *display,
meta_display_unmanage_screen (display, display->screen,
event->xselectionclear.time);
+ return TRUE;
}
static gboolean
@@ -1772,13 +1773,14 @@ meta_display_handle_xevent (MetaDisplay *display,
if (event->type == SelectionClear)
{
- /* Do this here so we can return without any further
- * processing. */
- process_selection_clear (display, event);
- /* Note that processing that may have resulted in
- * closing the display... */
- bypass_gtk = bypass_compositor = TRUE;
- goto out;
+ if (process_selection_clear (display, event))
+ {
+ /* This means we called meta_display_unmanage_screen, which
+ * means the MetaDisplay is effectively dead. We don't want
+ * to poke into display->current_time below, since that would
+ * crash, so just directly return. */
+ return TRUE;
+ }
}
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]