display: Check we have a screen before freeing it

The reason for the display to be closed may be meta_screen_new()
returning NULL, in which case we don't have a screen to free.
Avoid a segfault on exit by adding a proper check.

https://bugzilla.gnome.org/show_bug.cgi?id=778831
This commit is contained in:
Florian Müllner 2017-02-17 14:24:38 +01:00
parent 1b0a3f11f9
commit e1ffe15d94

View File

@ -1129,7 +1129,9 @@ meta_display_close (MetaDisplay *display,
meta_display_free_events_x11 (display); meta_display_free_events_x11 (display);
meta_display_free_events (display); meta_display_free_events (display);
if (display->screen)
meta_screen_free (display->screen, timestamp); meta_screen_free (display->screen, timestamp);
display->screen = NULL;
/* Must be after all calls to meta_window_unmanage() since they /* Must be after all calls to meta_window_unmanage() since they
* unregister windows * unregister windows