gsdx:recorder:unix: Fix thread leaking

This commit is contained in:
Jonathan Li 2016-10-28 17:49:41 +01:00
parent 7ab5cb20c8
commit ba557e20a4
2 changed files with 4 additions and 2 deletions

View File

@ -492,7 +492,7 @@ bool GSCapture::BeginCapture(float fps, GSVector2i recomendedResolution, float a
m_size.y = theApp.GetConfigI("CaptureHeight"); m_size.y = theApp.GetConfigI("CaptureHeight");
for(int i = 0; i < m_threads; i++) { for(int i = 0; i < m_threads; i++) {
m_workers.push_back(new GSPng::Worker()); m_workers.push_back(std::unique_ptr<GSPng::Worker>(new GSPng::Worker()));
} }
#endif #endif
@ -555,9 +555,11 @@ bool GSCapture::EndCapture()
} }
#elif defined(__unix__) #elif defined(__unix__)
// XXX Might not be necessary to wait
for(size_t i = 0; i < m_workers.size(); i++) { for(size_t i = 0; i < m_workers.size(); i++) {
m_workers[i]->Wait(); m_workers[i]->Wait();
} }
m_workers.clear();
m_frame = 0; m_frame = 0;

View File

@ -44,7 +44,7 @@ class GSCapture
#elif defined(__unix__) #elif defined(__unix__)
vector<GSPng::Worker*> m_workers; std::vector<std::unique_ptr<GSPng::Worker>> m_workers;
int m_compression_level; int m_compression_level;
#endif #endif