[gtk+] Fix an ordering issue in event destruction



commit 1a3bdefb00dd9a79e370fedeed7232a66771fc65
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Nov 1 14:44:03 2014 -0400

    Fix an ordering issue in event destruction
    
    gdk_event_get_display accesses event->any.window, so don't
    free that window first thing.

 gdk/gdkevents.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 89cc5a2..3d8d7bc 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -740,9 +740,6 @@ gdk_event_free (GdkEvent *event)
 
   g_return_if_fail (event != NULL);
 
-  if (event->any.window)
-    g_object_unref (event->any.window);
-  
   switch (event->any.type)
     {
     case GDK_KEY_PRESS:
@@ -814,6 +811,9 @@ gdk_event_free (GdkEvent *event)
   if (display)
     _gdk_display_event_data_free (display, event);
 
+  if (event->any.window)
+    g_object_unref (event->any.window);
+
   g_hash_table_remove (event_hash, event);
   g_slice_free (GdkEventPrivate, (GdkEventPrivate*) event);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]