src: crash fixes
* fixed crash when snippet has no code. * fixed crash when saving a filenode with special characters in its name * fixed crash when aborting the parsing
This commit is contained in:
@@ -23,7 +23,7 @@ Task::TaskState TaskGroupParallel::update()
|
||||
{
|
||||
for (size_t i = 0; i < m_tasks.size(); i++)
|
||||
{
|
||||
std::thread(&TaskGroupParallel::processTask, this, m_tasks[i]).detach();
|
||||
m_threads.push_back(std::thread(&TaskGroupParallel::processTask, this, m_tasks[i]));
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_activeTaskCountMutex);
|
||||
m_activeTaskCount++;
|
||||
@@ -47,6 +47,11 @@ Task::TaskState TaskGroupParallel::update()
|
||||
|
||||
void TaskGroupParallel::exit()
|
||||
{
|
||||
for (size_t i = 0; i < m_threads.size(); i++)
|
||||
{
|
||||
m_threads[i].join();
|
||||
}
|
||||
m_threads.clear();
|
||||
}
|
||||
|
||||
void TaskGroupParallel::interrupt()
|
||||
|
||||
@@ -23,6 +23,9 @@ private:
|
||||
|
||||
volatile bool m_interrupt;
|
||||
bool m_running;
|
||||
|
||||
std::vector<std::thread> m_threads;
|
||||
|
||||
volatile int m_activeTaskCount;
|
||||
std::mutex m_activeTaskCountMutex;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user