QFutureWatcher::connect: connecting after calling setFuture() is likely to produce race.
This commit is contained in:
parent
6164120969
commit
a0c1b6a512
|
@ -829,10 +829,10 @@ void MApplication::RepopulateMeasurementsDatabase(const QString &path)
|
|||
Q_UNUSED(path)
|
||||
if (m_knownMeasurementsDatabase != nullptr)
|
||||
{
|
||||
m_knownMeasurementsRepopulateWatcher->setFuture(
|
||||
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
|
||||
QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher<void>::finished, this,
|
||||
&MApplication::SyncKnownMeasurements);
|
||||
m_knownMeasurementsRepopulateWatcher->setFuture(
|
||||
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -284,10 +284,10 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
|
|||
{
|
||||
QEventLoop wait;
|
||||
QFutureWatcher<void> fw;
|
||||
QObject::connect(&fw, &QFutureWatcher<void>::finished, &wait, &QEventLoop::quit);
|
||||
fw.setFuture(
|
||||
QtConcurrent::run([&lGenerator, timer, nestingState]()
|
||||
{ lGenerator.Generate(timer, lGenerator.GetNestingTimeMSecs(), nestingState); }));
|
||||
QObject::connect(&fw, &QFutureWatcher<void>::finished, &wait, &QEventLoop::quit);
|
||||
wait.exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -235,10 +235,10 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop,
|
|||
return position.getBestResult();
|
||||
};
|
||||
|
||||
watcher.setFuture(QtConcurrent::mapped(jobs, Nest));
|
||||
|
||||
QEventLoop wait;
|
||||
QObject::connect(&watcher, &QFutureWatcher<VBestSquare>::finished, &wait, &QEventLoop::quit);
|
||||
|
||||
watcher.setFuture(QtConcurrent::mapped(jobs, Nest));
|
||||
wait.exec();
|
||||
|
||||
if (stop->load())
|
||||
|
|
Loading…
Reference in New Issue
Block a user