Browse Source

Fixed CID 1288858

AlexVinS 9 years ago
parent
commit
6d3259909e
1 changed files with 5 additions and 1 deletions
  1. 5 1
      lib/CThreadHelper.cpp

+ 5 - 1
lib/CThreadHelper.cpp

@@ -25,9 +25,13 @@ CThreadHelper::CThreadHelper(std::vector<std::function<void()> > *Tasks, int Thr
 void CThreadHelper::run()
 {
 	boost::thread_group grupa;
+	std::vector<boost::thread *> thr;
 	for(int i=0;i<threads;i++)
-		grupa.create_thread(std::bind(&CThreadHelper::processTasks,this));
+		thr.push_back(grupa.create_thread(std::bind(&CThreadHelper::processTasks,this)));
 	grupa.join_all();
+
+	for(auto thread : thr)
+		delete thread;
 }
 void CThreadHelper::processTasks()
 {