diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-23 09:59:06 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-23 11:12:08 +0100 |
commit | a80f8dcf2c6eb3b54658218bc081ee9694204dd5 (patch) | |
tree | 8342b730def57d7b33bd99d661a087dfe1f715b5 /src/notify.c | |
parent | e16ac0a8a8c18c831e95e1a0799e919e61f5da48 (diff) | |
download | calcurse-a80f8dcf2c6eb3b54658218bc081ee9694204dd5.zip |
Lock screen when drawing on the calendar/notification panel
Lock the screen if either the calendar panel or the notification bar is
updated to avoid race conditions.
Addresses BUG#6.
Note that we currently always use a screen-level lock, even if only one
window is affected. This is to be changed in the future.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/notify.c')
-rw-r--r-- | src/notify.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/notify.c b/src/notify.c index 10bc0f7..6ac94b9 100644 --- a/src/notify.c +++ b/src/notify.c @@ -240,11 +240,13 @@ void notify_update_bar(void) app_pos = file_pos + strlen(notify.apts_file) + 2 + space; txt_max_len = col - (app_pos + 12 + space); + wins_nbar_lock(); custom_apply_attr(notify.win, ATTR_HIGHEST); wattron(notify.win, A_UNDERLINE | A_REVERSE); mvwhline(notify.win, 0, 0, ACS_HLINE, col); mvwprintw(notify.win, 0, date_pos, "[ %s | %s ]", notify.date, notify.time); mvwprintw(notify.win, 0, file_pos, "(%s)", notify.apts_file); + wins_nbar_unlock(); pthread_mutex_lock(¬ify_app.mutex); if (notify_app.got_app) { @@ -271,6 +273,7 @@ void notify_update_bar(void) else blinking = 0; + wins_nbar_lock(); if (blinking) wattron(notify.win, A_BLINK); if (too_long) @@ -281,6 +284,7 @@ void notify_update_bar(void) hours_left, minutes_left, notify_app.txt); if (blinking) wattroff(notify.win, A_BLINK); + wins_nbar_unlock(); if (blinking) notify_launch_cmd(); @@ -295,8 +299,10 @@ void notify_update_bar(void) } pthread_mutex_unlock(¬ify_app.mutex); + wins_nbar_lock(); wattroff(notify.win, A_UNDERLINE | A_REVERSE); custom_remove_attr(notify.win, ATTR_HIGHEST); + wins_nbar_unlock(); wins_wrefresh(notify.win); pthread_mutex_unlock(¬ify.mutex); |