diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 6c4ff3615..6e4686076 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -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(); }