X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkdlg.c;h=eb93d3358baf16ff61f33b562be212f0740823e5;hb=b73527e641fa09ff57ffd4d20ec4e4045039b890;hp=1af7145c081578ddc05d2da9cef04b21c75067c3;hpb=0e6f6ff4eb47c9f88166baa7d41b926b26c7f4b2;p=PuTTY.git diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 1af7145c..eb93d335 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -910,9 +910,13 @@ void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn) { struct dlgparam *dp = (struct dlgparam *)dlg; struct uctrl *uc = dlg_find_byctrl(dp, ctrl); + /* We must copy fn->path before passing it to gtk_entry_set_text. + * See comment in dlg_editbox_set() for the reasons. */ + char *duppath = dupstr(fn->path); assert(uc->ctrl->generic.type == CTRL_FILESELECT); assert(uc->entry != NULL); - gtk_entry_set_text(GTK_ENTRY(uc->entry), fn->path); + gtk_entry_set_text(GTK_ENTRY(uc->entry), duppath); + sfree(duppath); } Filename *dlg_filesel_get(union control *ctrl, void *dlg) @@ -928,9 +932,13 @@ void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fs) { struct dlgparam *dp = (struct dlgparam *)dlg; struct uctrl *uc = dlg_find_byctrl(dp, ctrl); + /* We must copy fs->name before passing it to gtk_entry_set_text. + * See comment in dlg_editbox_set() for the reasons. */ + char *dupname = dupstr(fs->name); assert(uc->ctrl->generic.type == CTRL_FONTSELECT); assert(uc->entry != NULL); - gtk_entry_set_text(GTK_ENTRY(uc->entry), fs->name); + gtk_entry_set_text(GTK_ENTRY(uc->entry), dupname); + sfree(dupname); } FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)