aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog30
-rw-r--r--embed/ephy-embed-event.c12
-rw-r--r--embed/ephy-embed-event.h2
-rw-r--r--embed/ephy-embed-popup.c16
-rw-r--r--embed/ephy-embed-utils.c12
-rw-r--r--embed/mozilla/FilePicker.cpp22
-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
15 files changed, 108 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f48be97e..10c5ba5d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+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.
+
2003-01-17 Lee Willis <lwillis@plus.net>
* embed/ephy-history.c: Don't leak history xml every 5 minutes
diff --git a/embed/ephy-embed-event.c b/embed/ephy-embed-event.c
index fdbd53eab..45993dadb 100644
--- a/embed/ephy-embed-event.c
+++ b/embed/ephy-embed-event.c
@@ -75,11 +75,19 @@ ephy_embed_event_class_init (EphyEmbedEventClass *klass)
}
static void
+free_g_value (gpointer value)
+{
+ g_value_unset (value);
+ g_free (value);
+}
+
+static void
ephy_embed_event_init (EphyEmbedEvent *event)
{
event->priv = g_new0 (EphyEmbedEventPrivate, 1);
- event->priv->props = g_hash_table_new (g_str_hash, g_str_equal);
+ event->priv->props = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, free_g_value);
}
static void
@@ -161,7 +169,7 @@ ephy_embed_event_set_property (EphyEmbedEvent *event,
void
ephy_embed_event_get_property (EphyEmbedEvent *event,
const char *name,
- GValue **value)
+ const GValue **value)
{
*value = g_hash_table_lookup (event->priv->props, name);
}
diff --git a/embed/ephy-embed-event.h b/embed/ephy-embed-event.h
index 1256dcffc..69b3818a4 100644
--- a/embed/ephy-embed-event.h
+++ b/embed/ephy-embed-event.h
@@ -89,7 +89,7 @@ void ephy_embed_event_set_property (EphyEmbedEvent *event,
void ephy_embed_event_get_property (EphyEmbedEvent *event,
const char *name,
- GValue **value);
+ const GValue **value);
gboolean ephy_embed_event_has_property (EphyEmbedEvent *event,
const char *name);
diff --git a/embed/ephy-embed-popup.c b/embed/ephy-embed-popup.c
index cf9c5fee0..38587fe65 100644
--- a/embed/ephy-embed-popup.c
+++ b/embed/ephy-embed-popup.c
@@ -243,7 +243,7 @@ static void
setup_document_menu (EphyEmbedPopup *p)
{
gboolean is_framed;
- GValue *value;
+ const GValue *value;
gboolean has_background;
ephy_embed_event_get_property (p->priv->event,
@@ -354,7 +354,7 @@ embed_popup_copy_email_cmd (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
const char *location;
- GValue *value;
+ const GValue *value;
info = ephy_embed_popup_get_event (popup);
ephy_embed_event_get_property (info, "email", &value);
@@ -369,7 +369,7 @@ embed_popup_copy_link_location_cmd (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
const char *location;
- GValue *value;
+ const GValue *value;
info = ephy_embed_popup_get_event (popup);
ephy_embed_event_get_property (info, "link", &value);
@@ -385,7 +385,7 @@ save_property_url (EphyEmbedPopup *popup,
{
EphyEmbedEvent *info;
const char *location;
- GValue *value;
+ const GValue *value;
GtkWidget *widget;
GtkWidget *window;
EphyEmbedPersist *persist;
@@ -444,7 +444,7 @@ embed_popup_open_link_cmd (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
const char *location;
- GValue *value;
+ const GValue *value;
info = ephy_embed_popup_get_event (popup);
ephy_embed_event_get_property (info, "link", &value);
@@ -505,7 +505,7 @@ embed_popup_set_image_as_background_cmd (BonoboUIComponent *uic,
EphyEmbedEvent *info;
const char *location;
char *dest, *base;
- GValue *value;
+ const GValue *value;
EphyEmbedPersist *persist;
info = ephy_embed_popup_get_event (popup);
@@ -538,7 +538,7 @@ embed_popup_copy_image_location_cmd (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
const char *location;
- GValue *value;
+ const GValue *value;
info = ephy_embed_popup_get_event (popup);
ephy_embed_event_get_property (info, "image", &value);
@@ -624,7 +624,7 @@ embed_popup_open_image_cmd (BonoboUIComponent *uic,
{
EphyEmbedEvent *info;
const char *location;
- GValue *value;
+ const GValue *value;
info = ephy_embed_popup_get_event (popup);
ephy_embed_event_get_property (info, "image", &value);
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 373f4801f..e119d1f8a 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -176,7 +176,7 @@ build_group (GString *xml_string, const char *group, int index)
}
static void
-build_charset (GString *xml_string, CharsetInfo *info, int index)
+build_charset (GString *xml_string, const CharsetInfo *info, int index)
{
char *tmp;
char *verb;
@@ -227,7 +227,7 @@ ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
BonoboUIVerbFn fn,
gpointer data)
{
- GList *groups;
+ GList *groups, *gl;
GString *xml_string;
GList *verbs = NULL;
int group_index = 0;
@@ -241,9 +241,9 @@ ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
xml_string = g_string_new (NULL);
g_string_append (xml_string, "<submenu name=\"Encoding\" _label=\"_Encoding\">");
- for (; groups != NULL; groups = groups->next)
+ for (gl = groups; gl != NULL; gl = gl->next)
{
- GList *charsets;
+ GList *charsets, *cl;
const char *group = (const char *)groups->data;
build_group (xml_string, group, group_index);
@@ -252,9 +252,9 @@ ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component,
group,
&charsets);
- for (; charsets != NULL; charsets = charsets->next)
+ for (cl = charsets; cl != NULL; cl = cl->next)
{
- CharsetInfo *info = (CharsetInfo *) charsets->data;
+ const CharsetInfo *info = cl->data;
EncodingMenuData *edata;
edata = g_new0 (EncodingMenuData, 1);
diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp
index 424bc8910..e488a8a6f 100644
--- a/embed/mozilla/FilePicker.cpp
+++ b/embed/mozilla/FilePicker.cpp
@@ -339,21 +339,29 @@ NS_METHOD GFilePicker::InitWithGtkWidget (GtkWidget *aParentWidget,
NS_METHOD GFilePicker::SanityCheck (PRBool *retIsSane)
{
*retIsSane = PR_TRUE;
-
+
+ nsresult rv;
PRBool dirExists, fileExists = PR_TRUE;
if (mDisplayDirectory)
{
- mDisplayDirectory->Exists (&dirExists);
+ rv = mDisplayDirectory->Exists (&dirExists);
+ g_return_val_if_fail (NS_SUCCEEDED(rv), rv);
}
else
{
dirExists = PR_FALSE;
}
- if (mMode == nsIFilePicker::modeOpen)
+ if (mMode != nsIFilePicker::modeGetFolder)
{
- mFile->Exists (&fileExists);
+ rv = mFile->Exists (&fileExists);
+ g_return_val_if_fail (NS_SUCCEEDED(rv), rv);
+ }
+
+ if (mMode == nsIFilePicker::modeSave && !fileExists)
+ {
+ return NS_OK;
}
if (!dirExists || !fileExists)
@@ -380,13 +388,15 @@ NS_METHOD GFilePicker::SanityCheck (PRBool *retIsSane)
char *errorText;
if (mMode == nsIFilePicker::modeGetFolder)
{
- mDisplayDirectory->IsDirectory (&correctType);
+ rv = mDisplayDirectory->IsDirectory (&correctType);
+ g_return_val_if_fail (NS_SUCCEEDED(rv), rv);
errorText = g_strdup (_("A file was selected when a "
"folder was expected."));
}
else
{
- mFile->IsFile (&correctType);
+ rv = mFile->IsFile (&correctType);
+ g_return_val_if_fail (NS_SUCCEEDED(rv), rv);
errorText = g_strdup (_("A folder was selected when a "
"file was expected."));
}
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);