From 69ed9203aeab319f8529a77945dd09c983538fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Wed, 6 Jan 2016 15:54:43 -0500 Subject: Fix race condition over deletion of sema_logview sema_logview may only be deleted after the logview thread has been terminated, which can only be confirmed by joining with it. (The return of pthread_cancel() merely indicates that the cancellation request was successfully queued.) --- src/log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/log.cpp b/src/log.cpp index 136afd3..1f27e63 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -350,11 +350,11 @@ void t_log::enable_inform_user(bool on) { if (!thr_logview) { thr_logview = new t_thread(main_logview, NULL); - thr_logview->detach(); } } else { if (thr_logview) { thr_logview->cancel(); + thr_logview->join(); delete thr_logview; thr_logview = NULL; } -- cgit v1.2.3