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)
|
Q_UNUSED(path)
|
||||||
if (m_knownMeasurementsDatabase != nullptr)
|
if (m_knownMeasurementsDatabase != nullptr)
|
||||||
{
|
{
|
||||||
m_knownMeasurementsRepopulateWatcher->setFuture(
|
|
||||||
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
|
|
||||||
QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher<void>::finished, this,
|
QObject::connect(m_knownMeasurementsRepopulateWatcher, &QFutureWatcher<void>::finished, this,
|
||||||
&MApplication::SyncKnownMeasurements);
|
&MApplication::SyncKnownMeasurements);
|
||||||
|
m_knownMeasurementsRepopulateWatcher->setFuture(
|
||||||
|
QtConcurrent::run([this]() { m_knownMeasurementsDatabase->PopulateMeasurementsDatabase(); }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,10 +284,10 @@ auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
|
||||||
{
|
{
|
||||||
QEventLoop wait;
|
QEventLoop wait;
|
||||||
QFutureWatcher<void> fw;
|
QFutureWatcher<void> fw;
|
||||||
|
QObject::connect(&fw, &QFutureWatcher<void>::finished, &wait, &QEventLoop::quit);
|
||||||
fw.setFuture(
|
fw.setFuture(
|
||||||
QtConcurrent::run([&lGenerator, timer, nestingState]()
|
QtConcurrent::run([&lGenerator, timer, nestingState]()
|
||||||
{ lGenerator.Generate(timer, lGenerator.GetNestingTimeMSecs(), nestingState); }));
|
{ lGenerator.Generate(timer, lGenerator.GetNestingTimeMSecs(), nestingState); }));
|
||||||
QObject::connect(&fw, &QFutureWatcher<void>::finished, &wait, &QEventLoop::quit);
|
|
||||||
wait.exec();
|
wait.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,10 +235,10 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop,
|
||||||
return position.getBestResult();
|
return position.getBestResult();
|
||||||
};
|
};
|
||||||
|
|
||||||
watcher.setFuture(QtConcurrent::mapped(jobs, Nest));
|
|
||||||
|
|
||||||
QEventLoop wait;
|
QEventLoop wait;
|
||||||
QObject::connect(&watcher, &QFutureWatcher<VBestSquare>::finished, &wait, &QEventLoop::quit);
|
QObject::connect(&watcher, &QFutureWatcher<VBestSquare>::finished, &wait, &QEventLoop::quit);
|
||||||
|
|
||||||
|
watcher.setFuture(QtConcurrent::mapped(jobs, Nest));
|
||||||
wait.exec();
|
wait.exec();
|
||||||
|
|
||||||
if (stop->load())
|
if (stop->load())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user