From 9549ee0f8c1635fb5bd414ec03c36e8439411a03 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sat, 24 Jan 2009 20:41:52 +0000 Subject: do not crash when canceling the thread if it was not launched before --- src/calendar.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/calendar.c b/src/calendar.c index 12551ab..6728a84 100755 --- a/src/calendar.c +++ b/src/calendar.c @@ -1,8 +1,8 @@ -/* $calcurse: calendar.c,v 1.21 2008/12/28 13:13:59 culot Exp $ */ +/* $calcurse: calendar.c,v 1.22 2009/01/24 20:41:52 culot Exp $ */ /* * Calcurse - text-based organizer - * Copyright (c) 2004-2008 Frederic Culot + * Copyright (c) 2004-2009 Frederic Culot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,15 +86,14 @@ void calendar_start_date_thread (void) { pthread_create (&calendar_t_date, NULL, calendar_date_thread, NULL); - return; } /* Stop the calendar date thread. */ void calendar_stop_date_thread (void) { - pthread_cancel (calendar_t_date); - return; + if (calendar_t_date) + pthread_cancel (calendar_t_date); } /* Set static variable today to current date */ -- cgit v1.2.3