mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 10:20:50 +00:00
Simplify the stop process of thumbnail generators
This commit is contained in:
parent
ce27188852
commit
8ba0ea4519
@ -55,6 +55,12 @@ public:
|
||||
m_thread.join();
|
||||
}
|
||||
|
||||
void stop() const {
|
||||
base::scoped_lock lock(m_mutex);
|
||||
if (m_fop)
|
||||
m_fop->stop();
|
||||
}
|
||||
|
||||
bool isDone() const {
|
||||
return m_isDone;
|
||||
}
|
||||
@ -285,21 +291,9 @@ void ThumbnailGenerator::stopAllWorkers()
|
||||
}
|
||||
}
|
||||
|
||||
base::thread* ptr = new base::thread(base::Bind<void>(&ThumbnailGenerator::stopAllWorkersBackground, this));
|
||||
m_stopThread.reset(ptr);
|
||||
}
|
||||
|
||||
void ThumbnailGenerator::stopAllWorkersBackground()
|
||||
{
|
||||
WorkerList workersCopy;
|
||||
{
|
||||
base::scoped_lock hold(m_workersAccess);
|
||||
workersCopy = m_workers;
|
||||
m_workers.clear();
|
||||
}
|
||||
|
||||
for (auto worker : workersCopy)
|
||||
delete worker;
|
||||
base::scoped_lock hold(m_workersAccess);
|
||||
for (auto worker : m_workers)
|
||||
worker->stop();
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -43,8 +43,6 @@ namespace app {
|
||||
void stopAllWorkers();
|
||||
|
||||
private:
|
||||
void stopAllWorkersBackground();
|
||||
|
||||
class Worker;
|
||||
typedef std::vector<Worker*> WorkerList;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user