[epiphany/gnome-3-20] embed: avoid memory corruption when clearing top widgets



commit aef6ff196a303e692dde3225cdc0ca5ccf3a5711
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Mar 4 13:28:19 2017 -0600

    embed: avoid memory corruption when clearing top widgets
    
    Don't call remove_from_destroy_list_cb, which modifies the destroy list,
    when already iterating through the list.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779180

 embed/ephy-embed.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 1069abc..15a86b4 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -218,15 +218,6 @@ ephy_embed_statusbar_pop (EphyEmbed *embed, guint context_id)
 }
 
 static void
-ephy_embed_destroy_top_widgets (EphyEmbed *embed)
-{
-  GSList *iter;
-
-  for (iter = embed->destroy_on_transition_list; iter; iter = iter->next)
-    gtk_widget_destroy (GTK_WIDGET (iter->data));
-}
-
-static void
 remove_from_destroy_list_cb (GtkWidget *widget, EphyEmbed *embed)
 {
   GSList *list;
@@ -237,6 +228,19 @@ remove_from_destroy_list_cb (GtkWidget *widget, EphyEmbed *embed)
 }
 
 static void
+ephy_embed_destroy_top_widgets (EphyEmbed *embed)
+{
+  GSList *iter;
+
+  for (iter = embed->destroy_on_transition_list; iter; iter = iter->next) {
+    g_signal_handlers_disconnect_by_func (iter->data, remove_from_destroy_list_cb, embed);
+    gtk_widget_destroy (GTK_WIDGET (iter->data));
+  }
+
+  embed->destroy_on_transition_list = NULL;
+}
+
+static void
 ephy_embed_set_title (EphyEmbed  *embed,
                       const char *title)
 {


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