diff --git a/unix/gtkapp.c b/unix/gtkapp.c index e5cc6c6f..d7add6d1 100644 --- a/unix/gtkapp.c +++ b/unix/gtkapp.c @@ -192,9 +192,9 @@ static void post_initial_config_box(void *vctx, int result) { Conf *conf = (Conf *)vctx; - if (result) { + if (result > 0) { new_session_window(conf, NULL); - } else { + } else if (result == 0) { conf_free(conf); g_application_release(G_APPLICATION(app)); } diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 9e5ebf20..35973d9a 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -3316,8 +3316,7 @@ GtkWidget *create_config_box(const char *title, Conf *conf, static void dlgparam_destroy(GtkWidget *widget, gpointer data) { struct dlgparam *dp = (struct dlgparam *)data; - if (dp->retval >= 0) - dp->after(dp->afterctx, dp->retval); + dp->after(dp->afterctx, dp->retval); dlg_cleanup(dp); ctrl_free_box(dp->ctrlbox); #if GTK_CHECK_VERSION(2,0,0) diff --git a/unix/gtkmain.c b/unix/gtkmain.c index a70ceb5b..751a80ff 100644 --- a/unix/gtkmain.c +++ b/unix/gtkmain.c @@ -551,9 +551,9 @@ static void post_initial_config_box(void *vctx, int result) *(struct post_initial_config_box_ctx *)vctx; sfree(vctx); - if (result) { + if (result > 0) { new_session_window(ctx.conf, ctx.geometry_string); - } else { + } else if (result == 0) { /* In this main(), which only runs one session in total, a * negative result from the initial config box means we simply * terminate. */ diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 046cf09c..88b438a5 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -4016,6 +4016,13 @@ static void after_change_settings_dialog(void *vctx, int retval) sfree(vctx); /* we've copied this already */ + if (retval < 0) { + /* If the dialog box was aborted without giving a result + * (probably because the whole session window closed), we have + * nothing further to do. */ + return; + } + assert(lenof(ww) == NCFGCOLOURS); inst->reconfigure_dialog = NULL;