projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add proper error reports in write_random_seed, via the new 'nonfatal'
[u/mdw/putty]
/
unix
/
gtkdlg.c
diff --git
a/unix/gtkdlg.c
b/unix/gtkdlg.c
index
1af7145
..
6020497
100644
(file)
--- 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);
{
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);
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)
}
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);
{
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);
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)
}
FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)
@@
-3254,7
+3262,7
@@
int messagebox(GtkWidget *parentwin, char *title, char *msg, int minwid, ...)
return dp.retval;
}
return dp.retval;
}
-
static
int string_width(char *text)
+int string_width(char *text)
{
GtkWidget *label = gtk_label_new(text);
GtkRequisition req;
{
GtkWidget *label = gtk_label_new(text);
GtkRequisition req;
@@
-3381,6
+3389,13
@@
void fatal_message_box(void *window, char *msg)
"OK", 'o', 1, 1, NULL);
}
"OK", 'o', 1, 1, NULL);
}
+void nonfatal_message_box(void *window, char *msg)
+{
+ messagebox(window, "PuTTY Error", msg,
+ string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"),
+ "OK", 'o', 1, 1, NULL);
+}
+
void fatalbox(char *p, ...)
{
va_list ap;
void fatalbox(char *p, ...)
{
va_list ap;
@@
-3393,6
+3408,17
@@
void fatalbox(char *p, ...)
cleanup_exit(1);
}
cleanup_exit(1);
}
+void nonfatal(char *p, ...)
+{
+ va_list ap;
+ char *msg;
+ va_start(ap, p);
+ msg = dupvprintf(p, ap);
+ va_end(ap);
+ fatal_message_box(NULL, msg);
+ sfree(msg);
+}
+
static GtkWidget *aboutbox = NULL;
static void about_close_clicked(GtkButton *button, gpointer data)
static GtkWidget *aboutbox = NULL;
static void about_close_clicked(GtkButton *button, gpointer data)