[gtk+] Free the translate queue when closing a display



commit fbf1093d5c169ed947be689fcbf72b3c35732b5a
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 8 21:34:25 2011 -0400

    Free the translate queue when closing a display
    
    Not that many people are ever going to hit this.
    https://bugzilla.gnome.org/show_bug.cgi?id=645236

 gdk/x11/gdkdisplay-x11.c  |    3 +++
 gdk/x11/gdkgeometry-x11.c |   13 +++++++++++++
 gdk/x11/gdkprivate-x11.h  |    2 ++
 3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index c4d7763..575c68d 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1729,6 +1729,9 @@ gdk_x11_display_finalize (GObject *object)
 
   _gdk_x11_cursor_display_finalize (GDK_DISPLAY (display_x11));
 
+  /* Empty the event queue */
+  _gdk_x11_display_free_translate_queue (GDK_DISPLAY (display_x11));
+
   /* Atom Hashtable */
   g_hash_table_destroy (display_x11->atom_from_virtual);
   g_hash_table_destroy (display_x11->atom_to_virtual);
diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index 580183b..05bda6c 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -153,6 +153,19 @@ queue_item_free (GdkWindowQueueItem *item)
   g_free (item);
 }
 
+void
+_gdk_x11_display_free_translate_queue (GdkDisplay *display)
+{
+  GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
+
+  if (display_x11->translate_queue)
+    {
+      g_queue_foreach (display_x11->translate_queue, (GFunc)queue_item_free, NULL);
+      g_queue_free (display_x11->translate_queue);
+      display_x11->translate_queue = NULL;
+    }
+}
+
 static void
 gdk_window_queue (GdkWindow          *window,
 		  GdkWindowQueueItem *item)
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 2df2058..52ff852 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -138,6 +138,8 @@ void     _gdk_x11_window_translate         (GdkWindow *window,
                                             gint       dx,
                                             gint       dy);
 
+void     _gdk_x11_display_free_translate_queue (GdkDisplay *display);
+
 void     _gdk_x11_selection_window_destroyed   (GdkWindow            *window);
 gboolean _gdk_x11_selection_filter_clear_event (XSelectionClearEvent *event);
 



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