Join all threads before destructing the renaming engine

This commit is contained in:
Martchus 2020-11-27 00:40:45 +01:00
parent 246f4898df
commit 4387e50202
2 changed files with 12 additions and 0 deletions

View File

@ -36,6 +36,17 @@ RenamingEngine::RenamingEngine(QObject *parent)
connect(this, &RenamingEngine::changingsApplied, this, &RenamingEngine::processChangingsApplied); connect(this, &RenamingEngine::changingsApplied, this, &RenamingEngine::processChangingsApplied);
} }
RenamingEngine::~RenamingEngine()
{
#ifndef TAGEDITOR_NO_JSENGINE
for (auto *const child : children()) {
if (auto *const childThread = qobject_cast<QThread *>(child)) {
childThread->wait();
}
}
#endif
}
#ifndef TAGEDITOR_NO_JSENGINE #ifndef TAGEDITOR_NO_JSENGINE
bool RenamingEngine::setProgram(const TAGEDITOR_JS_VALUE &program) bool RenamingEngine::setProgram(const TAGEDITOR_JS_VALUE &program)
{ {

View File

@ -56,6 +56,7 @@ class RenamingEngine : public QObject {
public: public:
explicit RenamingEngine(QObject *parent = nullptr); explicit RenamingEngine(QObject *parent = nullptr);
~RenamingEngine() override;
FileSystemItem *rootItem() const; FileSystemItem *rootItem() const;
#ifndef TAGEDITOR_NO_JSENGINE #ifndef TAGEDITOR_NO_JSENGINE