mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-05-29 07:44:48 -05:00
Add code in dlg_filesel_set and dlg_fontsel_set which makes them
duplicate the strings they pass to gtk_entry_set_text. I was already doing that in dlg_editbox_set, but forgot to add the same code when I revamped FontSpec and Filename to contain dynamically allocated strings (r9314 and r9316 respectively). This fixes a bug where, on some versions of GTK (but apparently not up-to-date versions), loading a saved session causes gibberish to appear in file-selector edit boxes accompanied by a valgrind error. [originally from svn r9456] [r9314 == 9c75fe9a3fa5e6b709f1c210795d1140ca1be2e8] [r9316 == 62cbc7dc0b33808dc8794c59f60971fbba97894b]
This commit is contained in:
parent
63cb9c8356
commit
047dc326b4
@ -910,9 +910,13 @@ void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn)
|
|||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
struct dlgparam *dp = (struct dlgparam *)dlg;
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
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->ctrl->generic.type == CTRL_FILESELECT);
|
||||||
assert(uc->entry != NULL);
|
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)
|
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 dlgparam *dp = (struct dlgparam *)dlg;
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
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->ctrl->generic.type == CTRL_FONTSELECT);
|
||||||
assert(uc->entry != NULL);
|
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)
|
FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user