aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-01-20 08:19:13 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-01-20 08:19:13 +0800
commit5f2bf6e7fe67481c000fe9671a679feef79a2fcf (patch)
tree5b8407b11a0f143ff0289e509abc27f97cbac16e /src
parent29e1844f7711f8bcfb5f7c561c6368d6240a6c9b (diff)
downloadgsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar.gz
gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar.zst
gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.zip
Port several leaks fixes from galeon.
2003-01-20 Marco Pesenti Gritti <marco@it.gnome.org> * embed/ephy-embed-event.c: (free_g_value), (ephy_embed_event_init), (ephy_embed_event_get_property): * embed/ephy-embed-event.h: * embed/ephy-embed-popup.c: (setup_document_menu), (embed_popup_copy_email_cmd), (embed_popup_copy_link_location_cmd), (save_property_url), (embed_popup_open_link_cmd), (embed_popup_set_image_as_background_cmd), (embed_popup_copy_image_location_cmd), (embed_popup_open_image_cmd): * embed/ephy-embed-utils.c: (build_charset), (ephy_embed_utils_build_charsets_submenu): * embed/mozilla/FilePicker.cpp: * src/bookmarks/ephy-bookmarks.c: (update_favorites_menus): * src/ephy-nautilus-view.c: (gnv_embed_dom_mouse_down_cb), (gnv_popup_cmd_new_window), (gnv_popup_cmd_image_in_new_window): * src/ephy-shell.c: (ephy_shell_get_active_window): * src/ephy-tab.c: (ephy_tab_dom_mouse_down_cb): * src/ephy-window.c: (update_window_visibility), (update_spinner_control): * src/general-prefs.c: (language_dialog_changed_cb): * src/popup-commands.c: (popup_cmd_new_window), (popup_cmd_new_tab), (popup_cmd_image_in_new_tab), (popup_cmd_image_in_new_window), (popup_cmd_add_bookmark): * src/session.c: (session_close), (session_save): * src/session.h: Port several leaks fixes from galeon.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks.c2
-rw-r--r--src/ephy-nautilus-view.c6
-rw-r--r--src/ephy-shell.c2
-rw-r--r--src/ephy-tab.c2
-rw-r--r--src/ephy-window.c16
-rwxr-xr-xsrc/general-prefs.c9
-rw-r--r--src/popup-commands.c16
-rw-r--r--src/session.c16
-rw-r--r--src/session.h2
9 files changed, 37 insertions, 34 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 106a3298e..164c1a6cc 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -363,7 +363,7 @@ static void
update_favorites_menus ()
{
Session *session;
- GList *l;
+ const GList *l;
session = ephy_shell_get_session (ephy_shell);
l = session_get_windows (session);
diff --git a/src/ephy-nautilus-view.c b/src/ephy-nautilus-view.c
index 04916c37a..d4b853866 100644
--- a/src/ephy-nautilus-view.c
+++ b/src/ephy-nautilus-view.c
@@ -346,7 +346,7 @@ gnv_embed_dom_mouse_down_cb (EphyEmbed *embed,
else if (button == 1
&& (context & EMBED_CONTEXT_LINK))
{
- GValue *value;
+ const GValue *value;
const gchar *url;
ephy_embed_event_get_property (event, "link", &value);
url = g_value_get_string (value);
@@ -501,7 +501,7 @@ gnv_popup_cmd_new_window (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
EphyNautilusView *view;
- GValue *value;
+ const GValue *value;
view = gnv_view_from_popup (popup);
@@ -520,7 +520,7 @@ gnv_popup_cmd_image_in_new_window (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
EphyNautilusView *view;
- GValue *value;
+ const GValue *value;
view = gnv_view_from_popup (popup);
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 36828646f..feeb4d388 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -355,7 +355,7 @@ EphyWindow *
ephy_shell_get_active_window (EphyShell *gs)
{
Session *session;
- GList *windows;
+ const GList *windows;
session = ephy_shell_get_session (gs);
windows = session_get_windows (session);
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index a46c29c60..7561bb476 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -851,7 +851,7 @@ ephy_tab_dom_mouse_down_cb (EphyEmbed *embed,
else if (button == 1
&& (context & EMBED_CONTEXT_LINK))
{
- GValue *value;
+ const GValue *value;
ephy_embed_event_get_property (event, "link", &value);
ephy_shell_new_tab (ephy_shell, window, tab,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index e28c949cf..455602244 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1119,10 +1119,10 @@ update_find_control (EphyWindow *window)
static void
update_window_visibility (EphyWindow *window)
{
- GList *l;
+ GList *l, *tabs;
- l = ephy_window_get_tabs (window);
- for (; l != NULL; l = l->next)
+ tabs = ephy_window_get_tabs (window);
+ for (l = tabs; l != NULL; l = l->next)
{
EphyTab *tab = EPHY_TAB(l->data);
g_return_if_fail (IS_EPHY_TAB(tab));
@@ -1133,7 +1133,7 @@ update_window_visibility (EphyWindow *window)
return;
}
}
- g_list_free (l);
+ g_list_free (tabs);
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (window)))
{
@@ -1144,10 +1144,10 @@ update_window_visibility (EphyWindow *window)
static void
update_spinner_control (EphyWindow *window)
{
- GList *l;
+ GList *l, *tabs;
- l = ephy_window_get_tabs (window);
- for (; l != NULL; l = l->next)
+ tabs = ephy_window_get_tabs (window);
+ for (l = tabs; l != NULL; l = l->next)
{
EphyTab *tab = EPHY_TAB(l->data);
g_return_if_fail (IS_EPHY_TAB(tab));
@@ -1158,7 +1158,7 @@ update_spinner_control (EphyWindow *window)
return;
}
}
- g_list_free (l);
+ g_list_free (tabs);
toolbar_spinner_stop (window->priv->toolbar);
}
diff --git a/src/general-prefs.c b/src/general-prefs.c
index 114fde7ac..706820f43 100755
--- a/src/general-prefs.c
+++ b/src/general-prefs.c
@@ -444,21 +444,22 @@ language_dialog_changed_cb (LanguageEditor *le,
GeneralPrefs *dialog)
{
GtkWidget *optionmenu;
- GSList *l = list;
+ const GSList *l;
GSList *langs = NULL;
optionmenu = ephy_dialog_get_control (EPHY_DIALOG (dialog),
LANGUAGE_PROP);
gtk_option_menu_set_history (GTK_OPTION_MENU(optionmenu),
- (int)(l->data));
+ GPOINTER_TO_INT(list->data));
- for (; l != NULL; l = l->next)
+ for (l = list; l != NULL; l = l->next)
{
- int i = (int)l->data;
+ int i = GPOINTER_TO_INT (l->data);
langs = g_slist_append (langs, languages[i].code);
}
eel_gconf_set_string_list (CONF_RENDERING_LANGUAGE, langs);
+ g_slist_free (langs);
}
void
diff --git a/src/popup-commands.c b/src/popup-commands.c
index b7c39ca40..f1ec8ae74 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -31,7 +31,7 @@ void popup_cmd_new_window (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
EphyTab *tab;
- GValue *value;
+ const GValue *value;
tab = ephy_window_get_active_tab (get_window_from_popup (popup));
@@ -51,7 +51,7 @@ void popup_cmd_new_tab (BonoboUIComponent *uic,
EphyEmbedEvent *info;
EphyTab *tab;
EphyWindow *window;
- GValue *value;
+ const GValue *value;
window = get_window_from_popup (popup);
g_return_if_fail (window != NULL);
@@ -74,7 +74,7 @@ void popup_cmd_image_in_new_tab (BonoboUIComponent *uic,
EphyEmbedEvent *info;
EphyTab *tab;
EphyWindow *window;
- GValue *value;
+ const GValue *value;
window = get_window_from_popup (popup);
g_return_if_fail (window != NULL);
@@ -96,7 +96,7 @@ void popup_cmd_image_in_new_window (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
EphyTab *tab;
- GValue *value;
+ const GValue *value;
tab = ephy_window_get_active_tab (get_window_from_popup (popup));
@@ -118,10 +118,10 @@ void popup_cmd_add_bookmark (BonoboUIComponent *uic,
EphyEmbedEvent *info = ephy_embed_popup_get_event (popup);
EphyEmbed *embed;
GtkWidget *window;
- GValue *link_title;
- GValue *link_rel;
- GValue *link;
- GValue *link_is_smart;
+ const GValue *link_title;
+ const GValue *link_rel;
+ const GValue *link;
+ const GValue *link_is_smart;
const char *title;
const char *location;
const char *rel;
diff --git a/src/session.c b/src/session.c
index 927f7fd95..d050a9dcd 100644
--- a/src/session.c
+++ b/src/session.c
@@ -357,15 +357,16 @@ session_init (Session *session)
void
session_close (Session *session)
{
- GList *l;
+ GList *l, *windows;
/* close all windows */
- l = g_list_copy (session->priv->windows);
- for (; l != NULL; l = l->next)
+ windows = g_list_copy (session->priv->windows);
+ for (l = windows; l != NULL; l = l->next)
{
EphyWindow *window = EPHY_WINDOW(l->data);
gtk_widget_destroy (GTK_WIDGET(window));
}
+ g_list_free (windows);
}
static void
@@ -474,7 +475,7 @@ void
session_save (Session *session,
const char *filename)
{
- GList *w;
+ const GList *w;
xmlNodePtr root_node;
xmlNodePtr window_node;
xmlDocPtr doc;
@@ -494,7 +495,7 @@ session_save (Session *session,
/* iterate through all the windows */
for (; w != NULL; w = w->next)
{
- const GList *tabs;
+ GList *tabs, *l;
int x = 0, y = 0, width = 0, height = 0;
EphyWindow *window = EPHY_WINDOW(w->data);
GtkWidget *wmain;
@@ -521,11 +522,12 @@ session_save (Session *session,
snprintf(buffer, 32, "%d", height);
xmlSetProp (window_node, "height", buffer);
- for (; tabs != NULL; tabs = tabs->next)
+ for (l = tabs; l != NULL; l = l->next)
{
EphyTab *tab = EPHY_TAB(tabs->data);
save_tab (window, tab, doc, window_node);
}
+ g_list_free (tabs);
xmlAddChild (root_node, window_node);
}
@@ -637,7 +639,7 @@ session_load (Session *session,
g_free (save_to);
}
-GList *
+const GList *
session_get_windows (Session *session)
{
g_return_val_if_fail (IS_SESSION (session), NULL);
diff --git a/src/session.h b/src/session.h
index e2ac6b9b2..98c4f207b 100644
--- a/src/session.h
+++ b/src/session.h
@@ -69,7 +69,7 @@ void session_save (Session *session,
gboolean session_autoresume (Session *session);
-GList *session_get_windows (Session *session);
+const GList *session_get_windows (Session *session);
void session_add_window (Session *session,
EphyWindow *window);