GTK: fix handling of delete event in Change Settings dialog.

If the user closes the Change Settings dialog box using the close
button provided by the window manager (or some analogous thing that
generates the same X11 event) instead of using the Cancel button
within the dialog itself, then after_change_settings_dialog() gets
called with retval < 0, which triggers an early return path in which
we forget to call unregister_dialog(), and as a result, assertions
fail all over the place the _next_ time you try to put up a Change
Settings dialog.

Also, the early return causes ctx.newconf to be memory-leaked. So
rather than just moving the unregister_dialog() call to above the
early return, a better fix is to remove the early return completely,
and simply treat retval<0 the same as retval==0: it doesn't matter
_how_ the user closed the config box without committing the changes,
it only matters that they did.
This commit is contained in:
Simon Tatham 2019-06-03 19:05:00 +01:00
Родитель 45be166be3
Коммит 29cb7e40eb
1 изменённых файлов: 1 добавлений и 8 удалений

Просмотреть файл

@ -4635,18 +4635,11 @@ static void after_change_settings_dialog(void *vctx, int retval)
sfree(vctx); /* we've copied this already */ 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); assert(lenof(ww) == NCFGCOLOURS);
unregister_dialog(&inst->seat, DIALOG_SLOT_RECONFIGURE); unregister_dialog(&inst->seat, DIALOG_SLOT_RECONFIGURE);
if (retval) { if (retval > 0) {
inst->conf = newconf; inst->conf = newconf;
/* Pass new config data to the logging module */ /* Pass new config data to the logging module */