From 125daf062fdee81de64ad6f7a2bbf7f978edaaa5 Mon Sep 17 00:00:00 2001 From: laurentgom Date: Sun, 1 Mar 2009 10:56:38 +0000 Subject: [PATCH] Fixed Thread implementation not destroyed after Wait() or Terminate() git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1032 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/System/Thread.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SFML/System/Thread.cpp b/src/SFML/System/Thread.cpp index 3a88a9fcd..d6c29f42f 100644 --- a/src/SFML/System/Thread.cpp +++ b/src/SFML/System/Thread.cpp @@ -70,11 +70,7 @@ myUserData (UserData) //////////////////////////////////////////////////////////// Thread::~Thread() { - // Wait for the thread to finish before destroying the instance Wait(); - - // Destroy the implementation - delete myThreadImpl; } @@ -94,7 +90,11 @@ void Thread::Launch() void Thread::Wait() { if (myThreadImpl) + { myThreadImpl->Wait(); + delete myThreadImpl; + myThreadImpl = NULL; + } } @@ -107,7 +107,11 @@ void Thread::Wait() void Thread::Terminate() { if (myThreadImpl) + { myThreadImpl->Terminate(); + delete myThreadImpl; + myThreadImpl = NULL; + } }