diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-08-24 21:44:47 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-08-24 21:49:53 +0200 |
commit | e6f8a2932a9d66e905f0cf2e6d02fc17e1caad06 (patch) | |
tree | 67f497dfa3844e23b1ef95af7c814babf85c4ff2 /src/notify.c | |
parent | 8fe9dd1c2bb12b4909491dd54cce810e335e5c6f (diff) | |
download | calcurse-e6f8a2932a9d66e905f0cf2e6d02fc17e1caad06.zip |
Avoid starting the notification thread twice
Starting the notification thread more than once can result in strange
behavior. For example, when launching external commands, only the most
recently started thread is stopped which results in the external
command's screen output being overwritten by the notification bar.
Currently, there are a couple of situations where the thread is started
twice. As a first countermeasure, explicitly check whether the thread is
already running (and terminate it) before starting a new one.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/notify.c')
-rw-r--r-- | src/notify.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/notify.c b/src/notify.c index be88a31..3e14022 100644 --- a/src/notify.c +++ b/src/notify.c @@ -549,6 +549,9 @@ int notify_same_recur_item(struct recur_apoint *i) /* Launch the notify-bar main thread. */ void notify_start_main_thread(void) { + /* Avoid starting the notification bar thread twice. */ + notify_stop_main_thread(); + pthread_create(¬ify_t_main, NULL, notify_main_thread, NULL); notify_check_next_app(0); } |