Fix multiple, simultaneous periodic saves

A new save thread was started every time a positive periodic save value
was input in the general options configuration menu. And only one thread
can be stopped by entering 0, also when done repeatedly.

Always stop the old thread before (possibly) starting a new.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen authored and Lukas Fleischer committed 2018-07-28 14:21:38 +02:00
1 parent 5e53708648
commit 3788df6d78
1 file changed
+3 -3
+3 -3
View File
@@ -744,12 +744,12 @@ static void general_option_edit(int i)
status_mesg(periodic_save_str, ""); status_mesg(periodic_save_str, "");
if (updatestring(win[STA].p, &buf, 0, 1) == 0) { if (updatestring(win[STA].p, &buf, 0, 1) == 0) {
val = atoi(buf); val = atoi(buf);
if (val >= 0) if (val >= 0) {
conf.periodic_save = val; conf.periodic_save = val;
io_stop_psave_thread();
if (conf.periodic_save > 0) if (conf.periodic_save > 0)
io_start_psave_thread(); io_start_psave_thread();
else if (conf.periodic_save == 0) }
io_stop_psave_thread();
} }
break; break;
case CONFIRM_QUIT: case CONFIRM_QUIT: