From 38b8a8b97e0483cb9da5b2018f8d155be09761b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20St=C3=B6lp?= Date: Thu, 22 Oct 2020 20:24:56 +0200 Subject: fix memory leak when destroying Thread objects (#3) --- lib/thread.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/thread.h') diff --git a/lib/thread.h b/lib/thread.h index 3dfa457..4cae2e1 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -33,7 +33,7 @@ namespace nMatcha { Thread(const Thread&) = delete; Thread& operator=(const Thread&) = delete; Thread(); - virtual ~Thread() {} + virtual ~Thread(); bool isFinished() const; @@ -42,9 +42,13 @@ namespace nMatcha { private: virtual void threadFn() = 0; - static void entry(void* ctx); - void* mStackPtr; + + struct Stack { + void* mBottom; + size_t mSize; + void* mPtr; + } mStack; bool mFinished; friend struct Executor; -- cgit v1.2.3