[epiphany] ephy-embed: do not listen to status updates after dispose



commit b2fff0dd22d8c3dbcb3d88e1d044fdb68b4cea21
Author: Xan Lopez <xan igalia com>
Date:   Wed Jan 18 22:41:32 2012 +0100

    ephy-embed: do not listen to status updates after dispose
    
    Otherwise we might crash updating a dead statusbar widget.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=668171

 embed/ephy-embed.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 1d68bdf..1756449 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -88,6 +88,8 @@ struct _EphyEmbedPrivate
   guint pop_statusbar_later_source_id;
 
   guint clear_progress_source_id;
+
+  gulong status_handler_id;
 };
 
 G_DEFINE_TYPE (EphyEmbed, ephy_embed, GTK_TYPE_BOX)
@@ -275,6 +277,13 @@ ephy_embed_dispose (GObject *object)
     priv->pop_statusbar_later_source_id = 0;
   }
 
+  /* Do not listen to status message notifications anymore, if we try
+   * to update the statusbar after dispose we might crash. */
+  if (priv->status_handler_id) {
+    g_signal_handler_disconnect (priv->web_view, embed->priv->status_handler_id);
+    priv->status_handler_id = 0;
+  }
+
   G_OBJECT_CLASS (ephy_embed_parent_class)->dispose (object);
 }
 
@@ -611,9 +620,12 @@ ephy_embed_constructed (GObject *object)
                     "signal::resource-request-starting", G_CALLBACK (resource_request_starting_cb), embed,
                     "signal::download-requested", G_CALLBACK (download_requested_cb), embed,
                     "signal::notify::zoom-level", G_CALLBACK (zoom_changed_cb), embed,
-                    "signal::notify::status-message", G_CALLBACK (status_message_notify_cb), embed,
                     NULL);
 
+  embed->priv->status_handler_id = g_signal_connect (web_view, "notify::status-message",
+                                                     G_CALLBACK (status_message_notify_cb),
+                                                     embed);
+
   /* Window features */
   window_features = webkit_web_view_get_window_features (web_view);
   g_object_connect (window_features,



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