aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/uat_gui.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-09-03 14:41:02 -0700
committerGerald Combs <gerald@wireshark.org>2014-09-03 21:57:57 +0000
commit5e3a8fa85201b7f886ad41b85e6cf8c9eca4a978 (patch)
tree45bfd0cee368e1317d13606a7801250165e93545 /ui/gtk/uat_gui.c
parent35820294767a6f25e6cc70aeadbb05c8005ca532 (diff)
Work around an apparent bug in GtkFileChooserButton.
It looks like some versions of GTK+ intialize GtkFileChooserButton with a location set to NULL and crash when you select an item from the dropdown menu. Make sure we have a valid location set in that case. Change-Id: If2556ef939b95d8af12581a7116a48fb46586f57 Bug: 10434 Reviewed-on: https://code.wireshark.org/review/3977 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/gtk/uat_gui.c')
-rw-r--r--ui/gtk/uat_gui.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/gtk/uat_gui.c b/ui/gtk/uat_gui.c
index cc0c7d6b89..02c6d37447 100644
--- a/ui/gtk/uat_gui.c
+++ b/ui/gtk/uat_gui.c
@@ -503,6 +503,7 @@ static void uat_edit_dialog(uat_t *uat, gint row, gboolean copy) {
for ( colnum = 0; colnum < uat->ncols; colnum++ ) {
GtkWidget *entry, *label, *event_box;
char *text = fld_tostr(dd->rec, &(f[colnum]));
+ gchar *fc_filename;
event_box = gtk_event_box_new();
@@ -522,6 +523,17 @@ static void uat_edit_dialog(uat_t *uat, gint row, gboolean copy) {
if (! dd->is_new || copy) {
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(entry), text);
}
+
+ /*
+ * Some versions of GTK+ will crash if fc_filename is NULL.
+ * Make sure we have a valid location set.
+ */
+ fc_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(entry));
+ if (!fc_filename) {
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(entry), get_datafile_dir());
+ }
+ g_free(fc_filename);
+
g_ptr_array_add(dd->entries, entry);
ws_gtk_grid_attach_defaults(GTK_GRID(main_grid), entry, 1, colnum, 1, 1);
break;