diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-persist.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/embed/ephy-embed-persist.c b/embed/ephy-embed-persist.c index 5b02a10cc..92d7a99c8 100644 --- a/embed/ephy-embed-persist.c +++ b/embed/ephy-embed-persist.c @@ -154,9 +154,17 @@ void ephy_embed_persist_set_fc_parent (EphyEmbedPersist *persist, GtkWindow *value) { + EphyEmbedPersistPrivate *priv; + GtkWindow **wptr; + g_return_if_fail (EPHY_IS_EMBED_PERSIST (persist)); - persist->priv->fc_parent = value; + priv = persist->priv; + + priv->fc_parent = value; + wptr = &priv->fc_parent; + g_object_add_weak_pointer (G_OBJECT (priv->fc_parent), + (gpointer *) wptr); } /** @@ -447,11 +455,20 @@ static void ephy_embed_persist_finalize (GObject *object) { EphyEmbedPersist *persist = EPHY_EMBED_PERSIST (object); + EphyEmbedPersistPrivate *priv = persist->priv; + GtkWindow **wptr; + + g_free (priv->dest); + g_free (priv->source); + g_free (priv->fc_title); + g_free (priv->persist_key); - g_free (persist->priv->dest); - g_free (persist->priv->source); - g_free (persist->priv->fc_title); - g_free (persist->priv->persist_key); + if (priv->fc_parent != NULL) + { + wptr = &priv->fc_parent; + g_object_remove_weak_pointer (G_OBJECT (priv->fc_parent), + (gpointer *) wptr); + } LOG ("EphyEmbedPersist finalised %p", object); |