[vinagre] Fix freeing of RDP events during dispose



commit a1b80cd92b9d022d5c6310383f3838c75f7afcf3
Author: David King <amigadave amigadave com>
Date:   Mon Dec 15 12:18:06 2014 +0000

    Fix freeing of RDP events during dispose
    
    https://retrace.fedoraproject.org/faf2/problems/459789/

 plugins/rdp/vinagre-rdp-tab.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/plugins/rdp/vinagre-rdp-tab.c b/plugins/rdp/vinagre-rdp-tab.c
index 770fe99..c4c11f8 100644
--- a/plugins/rdp/vinagre-rdp-tab.c
+++ b/plugins/rdp/vinagre-rdp-tab.c
@@ -121,6 +121,13 @@ rdp_tab_get_tooltip (VinagreTab *tab)
 }
 
 static void
+free_frdpEvent (gpointer event,
+                G_GNUC_UNUSED gpointer user_data)
+{
+    g_free (event);
+}
+
+static void
 vinagre_rdp_tab_dispose (GObject *object)
 {
   VinagreRdpTab        *rdp_tab = VINAGRE_RDP_TAB (object);
@@ -137,10 +144,8 @@ vinagre_rdp_tab_dispose (GObject *object)
 
   if (priv->events)
     {
-      while (!g_queue_is_empty (priv->events))
-        g_free ((frdpEvent *) g_queue_pop_head (priv->events));
-
-      g_queue_free (priv->events);
+      g_queue_foreach (priv->events, free_frdpEvent, NULL);
+      g_clear_pointer (&priv->events, g_queue_free);
     }
 
   if (priv->update_id > 0)


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