Fix memory leak.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-07-18 17:34:43 +03:00
parent 0d7c406df4
commit a986f765a6

View File

@ -126,7 +126,11 @@ VBestSquare VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool
QScopedPointer<QThreadPool> thread_pool(new QThreadPool()); QScopedPointer<QThreadPool> thread_pool(new QThreadPool());
QVector<VPosition *> threads; QVector<VPosition *> threads;
auto Cleanup = qScopeGuard([threads] {qDeleteAll(threads.begin(), threads.end());}); auto Cleanup = qScopeGuard([&threads]
{
Q_ASSERT(not threads.isEmpty());
qDeleteAll(threads.begin(), threads.end());
});
for (int j=1; j <= data.gContour.GlobalEdgesCount(); ++j) for (int j=1; j <= data.gContour.GlobalEdgesCount(); ++j)
{ {
@ -145,6 +149,8 @@ VBestSquare VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool
} }
} }
Q_ASSERT(not threads.isEmpty());
// Wait for done // Wait for done
do do
{ {