summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2008-12-18 20:38:51 +0000
committerFrederic Culot <calcurse@culot.org>2008-12-18 20:38:51 +0000
commitd59b0e15abd775331cd07a886a37c1035028fe28 (patch)
tree30cf49966dfb511b016e9b964f60102b1d9ba7eb /src
parentb1d3178bba66089726e6f93a49af97371bdf5db8 (diff)
downloadcalcurse-d59b0e15abd775331cd07a886a37c1035028fe28.tar.gz
calcurse-d59b0e15abd775331cd07a886a37c1035028fe28.zip
memory leak due to wrong thread usage fixed
Diffstat (limited to 'src')
-rwxr-xr-xsrc/notify.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/notify.c b/src/notify.c
index 2973d16..49c589e 100755
--- a/src/notify.c
+++ b/src/notify.c
@@ -1,4 +1,4 @@
-/* $calcurse: notify.c,v 1.31 2008/12/12 20:44:50 culot Exp $ */
+/* $calcurse: notify.c,v 1.32 2008/12/18 20:38:52 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -37,6 +37,7 @@
static struct notify_vars_s *notify = NULL;
static struct notify_app_s *notify_app = NULL;
+static pthread_attr_t detached_thread_attr;
static pthread_t notify_t_main;
/* Return 1 if we need to display the notify-bar, else 0. */
@@ -70,6 +71,10 @@ notify_init_vars (void)
if ((nbar->shell = getenv ("SHELL")) == NULL)
nbar->shell = "/bin/sh";
+
+ (void)pthread_attr_init (&detached_thread_attr);
+ (void)pthread_attr_setdetachstate (&detached_thread_attr,
+ PTHREAD_CREATE_DETACHED);
}
/* Extract the appointment file name from the complete file path. */
@@ -307,7 +312,8 @@ notify_check_next_app (void)
{
pthread_t notify_t_app;
- pthread_create (&notify_t_app, NULL, notify_thread_app, NULL);
+ pthread_create (&notify_t_app, &detached_thread_attr, notify_thread_app,
+ (void *)0);
return;
}