From 9e9e5685b499be5660fa465d55175c737eef1dcf Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 21 Sep 2016 12:30:54 +0200 Subject: [PATCH] Fixed race condition bug in tinythread --- lib/tinythread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tinythread.cpp b/lib/tinythread.cpp index fed3b63f..5d17de4a 100644 --- a/lib/tinythread.cpp +++ b/lib/tinythread.cpp @@ -169,8 +169,10 @@ namespace tthread { // The thread is no longer executing if (ti->mThread) { lock_guard guard(ti->mThread->mDataMutex); - ti->mThread->mNotAThread = true; - ti->mThread->ti_copy = 0; + if (ti->mThread){ + ti->mThread->mNotAThread = true; + ti->mThread->ti_copy = 0; + } } // The thread is responsible for freeing the startup information