Merge pull request #995 from ispyisail/revive/713-collection-cancel-race

Cancel the collection-loading map before waiting on it in ~ElementsCollectionModel
This commit is contained in:
Laurent Trinques
2026-09-23 18:36:17 +02:00
committed by GitHub
@@ -49,6 +49,14 @@ ElementsCollectionModel::ElementsCollectionModel(QObject *parent) :
*/
ElementsCollectionModel::~ElementsCollectionModel()
{
// Without cancel(), the wait below runs the whole queued
// QtConcurrent::map() to completion, so closing this dialog on a
// large collection blocks until every remaining item has been
// processed -- a visible hang on the button pressed precisely to
// stop the work. cancel() drops the not-yet-started items so the
// wait that follows (still needed, so an in-flight item can't
// dereference this object after it's gone) is short.
m_future.cancel();
m_future.waitForFinished();
}