diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-04-14 02:08:55 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-04-14 02:08:55 +0800 |
commit | 5009179262c9faf39857e7bca14ad718b84ba51c (patch) | |
tree | 2243854b59c6cdb8aa0b22a305b68ced7493d8ef /src | |
parent | d4d88cfb05a492697310ef53da921ce2c95cef0a (diff) | |
download | gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.tar gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.tar.gz gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.tar.bz2 gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.tar.lz gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.tar.xz gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.tar.zst gsoc2013-epiphany-5009179262c9faf39857e7bca14ad718b84ba51c.zip |
Fix leaks. Dont truncate utf8 strings.
2003-04-13 Marco Pesenti Gritti <marco@it.gnome.org>
* embed/mozilla/mozilla-embed.cpp:
* src/ephy-tab.c: (ephy_tab_init), (ephy_tab_finalize),
(ephy_tab_set_favicon), (ephy_tab_favicon_cache_changed_cb),
(ephy_tab_link_message_cb), (ephy_tab_location_cb),
(ephy_tab_get_status_message):
Fix leaks. Dont truncate utf8 strings.
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-tab.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c index cc740f11a..fcdc63098 100644 --- a/src/ephy-tab.c +++ b/src/ephy-tab.c @@ -51,7 +51,7 @@ struct EphyTabPrivate gboolean is_active; TabLoadStatus load_status; char status_message[255]; - char link_message[255]; + char *link_message; char favicon_url[255]; char *title; char *location; @@ -201,15 +201,11 @@ ephy_tab_init (EphyTab *tab) tab->priv = g_new0 (EphyTabPrivate, 1); - tab->priv->embed = ephy_embed_new (G_OBJECT(single)); - ephy_embed_shell_add_embed (EPHY_EMBED_SHELL (ephy_shell), - tab->priv->embed); - tab->priv->window = NULL; tab->priv->event = NULL; tab->priv->is_active = FALSE; *tab->priv->status_message = '\0'; - *tab->priv->link_message = '\0'; + tab->priv->link_message = NULL; *tab->priv->favicon_url = '\0'; tab->priv->load_status = TAB_LOAD_NONE; tab->priv->load_percent = 0; @@ -220,6 +216,9 @@ ephy_tab_init (EphyTab *tab) tab->priv->width = -1; tab->priv->height = -1; + tab->priv->embed = ephy_embed_new (G_OBJECT(single)); + ephy_embed_shell_add_embed (EPHY_EMBED_SHELL (ephy_shell), + tab->priv->embed); embed = G_OBJECT (tab->priv->embed); embed_widget = G_OBJECT (tab->priv->embed); @@ -303,6 +302,7 @@ ephy_tab_finalize (GObject *object) } g_free (tab->priv->location); + g_free (tab->priv->link_message); g_free (tab->priv); @@ -451,7 +451,7 @@ ephy_tab_set_visibility (EphyTab *tab, } static void -ephy_tab_set_favicon (EphyTab *tab, +ephy_tab_set_favicon (EphyTab *tab, GdkPixbuf *favicon) { GtkWidget *nb; @@ -474,8 +474,8 @@ ephy_tab_set_favicon (EphyTab *tab, /* Private callbacks for embed signals */ static void -ephy_tab_favicon_cache_changed_cb (EphyFaviconCache *cache, - char *url, +ephy_tab_favicon_cache_changed_cb (EphyFaviconCache *cache, + char *url, EphyTab *tab) { GdkPixbuf *pixbuf = NULL; @@ -486,7 +486,7 @@ ephy_tab_favicon_cache_changed_cb (EphyFaviconCache *cache, /* set favicon */ pixbuf = ephy_favicon_cache_get (cache, tab->priv->favicon_url); ephy_tab_set_favicon (tab, pixbuf); - + if (pixbuf) g_object_unref (pixbuf); } @@ -523,8 +523,8 @@ ephy_tab_link_message_cb (EphyEmbed *embed, { if (!tab->priv->is_active) return; - g_strlcpy (tab->priv->link_message, - message, 255); + g_free (tab->priv->link_message); + tab->priv->link_message = g_strdup (message); ephy_window_update_control (tab->priv->window, StatusbarMessageControl); @@ -536,8 +536,7 @@ ephy_tab_location_cb (EphyEmbed *embed, EphyTab *tab) if (tab->priv->location) g_free (tab->priv->location); ephy_embed_get_location (embed, TRUE, &tab->priv->location); - tab->priv->link_message[0] = '\0'; - + tab->priv->link_message = NULL; tab->priv->favicon_url[0] = '\0'; ephy_tab_set_favicon (tab, NULL); @@ -1022,7 +1021,7 @@ ephy_tab_get_load_percent (EphyTab *tab) const char * ephy_tab_get_status_message (EphyTab *tab) { - if (*tab->priv->link_message) + if (tab->priv->link_message) { return tab->priv->link_message; } |