summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2017-03-04 13:28:19 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2017-03-04 13:30:30 -0600
commite819b36748519b3225bc596e3e0f577a28b3a560 (patch)
tree5848ef16686f769331e38bf276b28d822239f261
parentf6cd6a9a0c00471f8fce97f484c98780df2e3ca7 (diff)
downloadepiphany-e819b36748519b3225bc596e3e0f577a28b3a560.tar.gz
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
-rw-r--r--embed/ephy-embed.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index b12516e86..d8f2c1631 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -219,15 +219,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;
@@ -238,6 +229,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)
{