From e16ac0a8a8c18c831e95e1a0799e919e61f5da48 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 23 Nov 2012 10:53:37 +0100 Subject: Do not display a mark when files are auto-saved This is kind of useless since users are not able to react to an auto-save notification. It also causes all kinds of problems if the status bar is in a non-standard mode (message, prompt, ...) and is prone to race conditions if the status bar is updated by another thread at the same time. Signed-off-by: Lukas Fleischer --- src/calcurse.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index 7259dd1..e35fe9a 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -580,7 +580,6 @@ enum export_type { /* To customize the display when saving data. */ enum save_display { IO_SAVE_DISPLAY_BAR, - IO_SAVE_DISPLAY_MARK, IO_SAVE_DISPLAY_NONE }; -- cgit v1.2.3 From a80f8dcf2c6eb3b54658218bc081ee9694204dd5 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 23 Nov 2012 09:59:06 +0100 Subject: 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 --- src/calcurse.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index e35fe9a..7a7f4f2 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -975,6 +975,10 @@ void vars_init(void); /* wins.c */ extern struct window win[NBWINS]; +unsigned wins_nbar_lock(void); +void wins_nbar_unlock(void); +unsigned wins_calendar_lock(void); +void wins_calendar_unlock(void); int wins_refresh(void); int wins_wrefresh(WINDOW *); int wins_doupdate(void); -- cgit v1.2.3 From 0ea23c24bf06e153bb075804e195e1733fd67d3f Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 23 Nov 2012 10:41:20 +0100 Subject: Release screen mutex if thread dies We did not setup a thread cleanup procedure which resulted in calcurse freezing if a thread tried to draw on the screen after another thread was canceled while locking the screen. Note that this kind of cleanup handlers should be added to other mutexes as well. This patch just removes the most common case of triggering a deadlock. Also note that we cannot move pthread_cleanup_push() and pthread_cleanup_pop() into the locking/unlocking functions since both pthread_cleanup_push() and pthread_cleanup_pop() may be implemented as macros that must be used in pairs within the same lexical scope. Signed-off-by: Lukas Fleischer --- src/calcurse.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/calcurse.h') diff --git a/src/calcurse.h b/src/calcurse.h index 7a7f4f2..d7b5093 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -456,6 +456,22 @@ enum win { #define FLAG_STA (1 << STA) #define FLAG_ALL ((1 << NBWINS) - 1) +#define WINS_NBAR_LOCK \ + pthread_cleanup_push(wins_nbar_cleanup, NULL); \ + wins_nbar_lock(); + +#define WINS_NBAR_UNLOCK \ + wins_nbar_unlock(); \ + pthread_cleanup_pop(0); + +#define WINS_CALENDAR_LOCK \ + pthread_cleanup_push(wins_calendar_cleanup, NULL); \ + wins_calendar_lock(); + +#define WINS_CALENDAR_UNLOCK \ + wins_calendar_unlock(); \ + pthread_cleanup_pop(0); + enum ui_mode { UI_CURSES, UI_CMDLINE, @@ -977,8 +993,10 @@ void vars_init(void); extern struct window win[NBWINS]; unsigned wins_nbar_lock(void); void wins_nbar_unlock(void); +void wins_nbar_cleanup(void *); unsigned wins_calendar_lock(void); void wins_calendar_unlock(void); +void wins_calendar_cleanup(void *); int wins_refresh(void); int wins_wrefresh(WINDOW *); int wins_doupdate(void); -- cgit v1.2.3