Index: trunk/src/conf.c =================================================================== --- trunk/src/conf.c (revision 2247) +++ trunk/src/conf.c (revision 2248) @@ -1380,6 +1380,11 @@ return conf_root_lock[target]; } +int conf_isdirty(conf_role_t target) +{ + return conf_lht_dirty[target]; +} + void conf_reset(conf_role_t target, const char *source_fn) { if (conf_root[target] != NULL) Index: trunk/src/conf.h =================================================================== --- trunk/src/conf.h (revision 2247) +++ trunk/src/conf.h (revision 2248) @@ -224,6 +224,9 @@ /* Returns whether a given lihata tree is locked */ int conf_islocked(conf_role_t target); +/* Returns whether a given lihata tree has changed since load or last save */ +int conf_isdirty(conf_role_t target); + /* all configuration fields ever seen */ extern htsp_t *conf_fields; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 2247) +++ trunk/src/main.c (revision 2248) @@ -218,6 +218,9 @@ void pcb_main_uninit(void) { + if (conf_isdirty(CFR_USER)) + conf_save_file(NULL, NULL, CFR_USER, NULL); + UninitBuffers(); /* Free up memory allocated to the PCB. Why bother when we're about to exit ?