From a3c185e796190610eee690c103a927bf7cfcfa4d Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Mon, 5 Nov 2007 23:01:23 +0000 Subject: Make ephy_base_embed_set_{title,address} dup their parameters internally. svn path=/trunk/; revision=7636 --- embed/ephy-base-embed.c | 11 +++++++---- embed/ephy-base-embed.h | 5 +++-- embed/mozilla/mozilla-embed.cpp | 4 +++- embed/webkit/webkit-embed.cpp | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c index 11b5ac345..aa82ed284 100644 --- a/embed/ephy-base-embed.c +++ b/embed/ephy-base-embed.c @@ -647,13 +647,14 @@ ephy_embed_iface_init (EphyEmbedIface *iface) } void -ephy_base_embed_set_address (EphyBaseEmbed *embed, char *address) +ephy_base_embed_set_address (EphyBaseEmbed *embed, + const char *address) { EphyBaseEmbedPrivate *priv = embed->priv; GObject *object = G_OBJECT (embed); g_free (priv->address); - priv->address = address; + priv->address = g_strdup (address); priv->is_blank = address == NULL || strcmp (address, "about:blank") == 0; @@ -695,9 +696,10 @@ get_title_from_address (const char *address) void ephy_base_embed_set_title (EphyBaseEmbed *embed, - char *title) + const char *embed_title) { EphyBaseEmbedPrivate *priv = embed->priv; + char *title = g_strdup (embed_title); if (!priv->is_blank && (title == NULL || g_strstrip (title)[0] == '\0')) { g_free (title); @@ -727,7 +729,7 @@ ensure_page_info (EphyBaseEmbed *embed, const char *address) if ((priv->address == NULL || priv->address[0] == '\0') && priv->address_expire == EPHY_EMBED_ADDRESS_EXPIRE_NOW) { - ephy_base_embed_set_address (embed, g_strdup (address)); + ephy_base_embed_set_address (embed, address); } /* FIXME huh?? */ @@ -1125,6 +1127,7 @@ ephy_base_embed_location_changed (EphyBaseEmbed *embed, embed_address = ephy_embed_get_location (EPHY_EMBED (embed), TRUE); ephy_base_embed_set_address (embed, embed_address); ephy_base_embed_set_loading_title (embed, embed_address, TRUE); + g_free (embed_address); } ephy_base_embed_set_link_message (embed, NULL); diff --git a/embed/ephy-base-embed.h b/embed/ephy-base-embed.h index 82c303a49..310f3f928 100644 --- a/embed/ephy-base-embed.h +++ b/embed/ephy-base-embed.h @@ -52,11 +52,12 @@ struct _EphyBaseEmbed { GType ephy_base_embed_get_type (void) G_GNUC_CONST; void ephy_base_embed_set_title (EphyBaseEmbed *embed, - char *title); + const char *title); void ephy_base_embed_set_loading_title (EphyBaseEmbed *embed, const char *title, gboolean is_address); -void ephy_base_embed_set_address (EphyBaseEmbed *embed, char *address); +void ephy_base_embed_set_address (EphyBaseEmbed *embed, + const char *address); void ephy_base_embed_location_changed (EphyBaseEmbed *embed, char *location); void ephy_base_embed_load_icon (EphyBaseEmbed *embed); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 455d81b56..ae9ac7d22 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -1152,6 +1152,8 @@ mozilla_embed_title_change_cb (GtkMozEmbed *embed, ephy_base_embed_set_loading_title (EPHY_BASE_EMBED (membed), title, FALSE); + g_free (title); + g_object_thaw_notify (object); } @@ -1168,7 +1170,7 @@ mozilla_embed_open_uri_cb (GtkMozEmbed *embed, EphyBaseEmbed *bembed = EPHY_BASE_EMBED (membed); - ephy_base_embed_set_address (bembed, g_strdup (uri)); + ephy_base_embed_set_address (bembed, uri); ephy_base_embed_set_loading_title (bembed, uri, TRUE); } diff --git a/embed/webkit/webkit-embed.cpp b/embed/webkit/webkit-embed.cpp index 3ad05833a..499819abc 100644 --- a/embed/webkit/webkit-embed.cpp +++ b/embed/webkit/webkit-embed.cpp @@ -104,7 +104,7 @@ webkit_embed_title_changed_cb (WebKitFrame *frame, EphyEmbed *embed) { ephy_base_embed_set_title (EPHY_BASE_EMBED (embed), - g_strdup (title)); + title); ephy_base_embed_location_changed (EPHY_BASE_EMBED (embed), location); } -- cgit v1.2.3