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
This commit is contained in:
laurentgom 2009-03-01 10:56:38 +00:00
parent 9a7fcc04be
commit 125daf062f

View File

@ -70,11 +70,7 @@ myUserData (UserData)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Thread::~Thread() Thread::~Thread()
{ {
// Wait for the thread to finish before destroying the instance
Wait(); Wait();
// Destroy the implementation
delete myThreadImpl;
} }
@ -94,7 +90,11 @@ void Thread::Launch()
void Thread::Wait() void Thread::Wait()
{ {
if (myThreadImpl) if (myThreadImpl)
{
myThreadImpl->Wait(); myThreadImpl->Wait();
delete myThreadImpl;
myThreadImpl = NULL;
}
} }
@ -107,7 +107,11 @@ void Thread::Wait()
void Thread::Terminate() void Thread::Terminate()
{ {
if (myThreadImpl) if (myThreadImpl)
{
myThreadImpl->Terminate(); myThreadImpl->Terminate();
delete myThreadImpl;
myThreadImpl = NULL;
}
} }