Avoid accessing freed memory when being replaced

If we are replaced via the window manager selection, then we close
the MetaDisplay before meta_finalize() runs. We should be careful
not to try to close the display again (and access already freed
memory) in that case, so clear the global 'the_display' variable.

See Metacity bug http://bugzilla.gnome.org/show_bug.cgi?id=588119

http://bugzilla.gnome.org/show_bug.cgi?id=592742
This commit is contained in:
Owen W. Taylor 2009-08-22 15:55:17 -04:00
parent d804a1f146
commit d58c9a57c6
2 changed files with 6 additions and 2 deletions

View File

@ -1007,6 +1007,7 @@ meta_display_close (MetaDisplay *display,
meta_compositor_destroy (display->compositor);
g_object_unref (display);
the_display = NULL;
meta_quit (META_EXIT_SUCCESS);
}

View File

@ -427,8 +427,11 @@ 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 ();
if (display)
meta_display_close (display,
CurrentTime); /* I doubt correct timestamps matter here */
meta_session_shutdown ();
}