From 55afda8a7387ae670ead4cc07a250ac969723aa1 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <lfleischer@calcurse.org>
Date: Tue, 13 Sep 2016 08:25:35 +0200
Subject: Stop all threads before leaving curses mode

This prevents from notification bar artifacts being drawn after leaving
interactive mode.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 src/utils.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/utils.c b/src/utils.c
index 50f2507..14683fc 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -75,6 +75,9 @@ void exit_calcurse(int status)
 {
 	int was_interactive;
 
+	ui_calendar_stop_date_thread();
+	io_stop_psave_thread();
+
 	if (ui_mode == UI_CURSES) {
 		notify_stop_main_thread();
 		clear();
@@ -86,11 +89,10 @@ void exit_calcurse(int status)
 		was_interactive = 0;
 	}
 
-	ui_calendar_stop_date_thread();
-	io_stop_psave_thread();
 	free_user_data();
 	keys_free();
 	mem_stats();
+
 	if (was_interactive) {
 		if (unlink(path_cpid) != 0)
 			EXIT(_("Could not remove calcurse lock file: %s\n"),
-- 
cgit v1.2.3-70-g09d2