summaryrefslogtreecommitdiff
path: root/gtk/dialogs
diff options
context:
space:
mode:
authorFran├žois Revel <mmu_man@netsurf-browser.org>2012-04-07 18:32:11 +0000
committerFran├žois Revel <mmu_man@netsurf-browser.org>2012-04-07 18:32:11 +0000
commitbae750ee441c1fdfd10d81190fdd3346d530059a (patch)
tree47ad7b412f97f3cade2c37fac52a143ab9d4cbea /gtk/dialogs
parent87b9a905eb68dca81a91a3c0b9cdb8ffaafc7691 (diff)
downloadnetsurf-bae750ee441c1fdfd10d81190fdd3346d530059a.tar.gz
netsurf-bae750ee441c1fdfd10d81190fdd3346d530059a.tar.bz2
Fix a crash when opening Preferences panel and Choices file doesn't exist:
- add missing strdup(), - fix free() vs g_free() mixups. svn path=/trunk/netsurf/; revision=13824
Diffstat (limited to 'gtk/dialogs')
-rw-r--r--gtk/dialogs/options.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gtk/dialogs/options.c b/gtk/dialogs/options.c
index 62cf9061f..8cf949b31 100644
--- a/gtk/dialogs/options.c
+++ b/gtk/dialogs/options.c
@@ -577,7 +577,7 @@ static gboolean on_comboLanguage_changed(GtkWidget *widget, gpointer data)
if (lang == NULL)
return FALSE;
- nsoption_set_charp(accept_language, lang);
+ nsoption_set_charp(accept_language, strdup(lang));
g_free(lang);
@@ -863,9 +863,13 @@ CHECK_CHANGED(checkRequestOverwrite, request_overwrite)
END_HANDLER
static gboolean on_fileChooserDownloads_changed(GtkWidget *widget, gpointer data)
-{
- LOG(("Signal emitted on '%s'", "fileChooserDownloads"));
- nsoption_set_charp(downloads_directory, gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER((widget))));
+{
+ gchar *dir;
+ LOG(("Signal emitted on '%s'", "fileChooserDownloads"));
+
+ dir = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER((widget)));
+ nsoption_set_charp(downloads_directory, strdup(dir));
+ g_free(dir);
return FALSE;
}
@@ -968,21 +972,21 @@ BUTTON_CLICKED(buttonaddtheme)
0);
gtk_widget_destroy(GTK_WIDGET(fc));
if (filename != NULL)
- free(filename);
+ g_free(filename);
return FALSE;
} else {
directory++;
}
} else {
if (filename != NULL)
- free(filename);
+ g_free(filename);
filename = gtk_file_chooser_get_filename(
GTK_FILE_CHOOSER(fc));
if (strcmp(filename, themesfolder) == 0) {
warn_user(messages_get("gtkThemeFolderSub"),
0);
gtk_widget_destroy(GTK_WIDGET(fc));
- free(filename);
+ g_free(filename);
return FALSE;
}
directory = strrchr(filename, '/') + 1;
@@ -990,7 +994,7 @@ BUTTON_CLICKED(buttonaddtheme)
gtk_widget_destroy(GTK_WIDGET(fc));
nsgtk_theme_add(directory);
if (filename != NULL)
- free(filename);
+ g_free(filename);
}
}
END_HANDLER