Fix some possible crashes if the default display is NULL

Unlikely that many people will hit these, but still.
https://bugzilla.gnome.org/show_bug.cgi?id=645176
This commit is contained in:
Matthias Clasen
2011-04-08 21:20:26 -04:00
parent 32358a58f4
commit 9e6d3d969c
3 changed files with 9 additions and 3 deletions

View File

@ -605,6 +605,8 @@ gdk_event_copy (const GdkEvent *event)
void
gdk_event_free (GdkEvent *event)
{
GdkDisplay *display;
g_return_if_fail (event != NULL);
if (event->any.window)
@ -670,7 +672,9 @@ gdk_event_free (GdkEvent *event)
break;
}
_gdk_display_event_data_free (gdk_display_get_default (), event);
display = gdk_display_get_default ();
if (display)
_gdk_display_event_data_free (display, event);
g_hash_table_remove (event_hash, event);
g_slice_free (GdkEventPrivate, (GdkEventPrivate*) event);