diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-20 08:19:13 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-20 08:19:13 +0800 |
commit | 5f2bf6e7fe67481c000fe9671a679feef79a2fcf (patch) | |
tree | 5b8407b11a0f143ff0289e509abc27f97cbac16e /embed | |
parent | 29e1844f7711f8bcfb5f7c561c6368d6240a6c9b (diff) | |
download | gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar.gz gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar.bz2 gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar.lz gsoc2013-epiphany-5f2bf6e7fe67481c000fe9671a679feef79a2fcf.tar.xz 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 'embed')
-rw-r--r-- | embed/ephy-embed-event.c | 12 | ||||
-rw-r--r-- | embed/ephy-embed-event.h | 2 | ||||
-rw-r--r-- | embed/ephy-embed-popup.c | 16 | ||||
-rw-r--r-- | embed/ephy-embed-utils.c | 12 | ||||
-rw-r--r-- | embed/mozilla/FilePicker.cpp | 22 |
5 files changed, 41 insertions, 23 deletions
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.")); } |