diff options
author | Frederic Culot <calcurse@culot.org> | 2009-08-13 17:30:42 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2009-08-13 17:30:42 +0000 |
commit | 8ba49be8564aca874f6b9dc537ff360ac6ea4757 (patch) | |
tree | 2776d801bedb9956a8ec69c268aa45863131956d /src | |
parent | 220f49f2066109fc2817d49b0d8e86885138610b (diff) | |
download | calcurse-8ba49be8564aca874f6b9dc537ff360ac6ea4757.zip |
Possible deadlock fixed, thanks Henrik for reporting it.
Diffstat (limited to 'src')
-rwxr-xr-x | src/notify.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/notify.c b/src/notify.c index 1d4eb51..cf57ef3 100755 --- a/src/notify.c +++ b/src/notify.c @@ -1,4 +1,4 @@ -/* $calcurse: notify.c,v 1.45 2009/08/09 15:34:56 culot Exp $ */ +/* $calcurse: notify.c,v 1.46 2009/08/13 17:30:42 culot Exp $ */ /* * Calcurse - text-based organizer @@ -429,17 +429,21 @@ notify_thread_app (void *arg) if (!notify_get_next (&tmp_app)) pthread_exit ((void *)0); - pthread_mutex_lock (¬ify_app.mutex); if (!tmp_app.got_app) { + pthread_mutex_lock (¬ify_app.mutex); notify_free_app (); + pthread_mutex_unlock (¬ify_app.mutex); } else { if (!notify_same_item (tmp_app.time)) - notify_update_app (tmp_app.time, tmp_app.state, tmp_app.txt); + { + pthread_mutex_lock (¬ify_app.mutex); + notify_update_app (tmp_app.time, tmp_app.state, tmp_app.txt); + pthread_mutex_unlock (¬ify_app.mutex); + } } - pthread_mutex_unlock (¬ify_app.mutex); if (tmp_app.txt) mem_free (tmp_app.txt); |