aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;