# HG changeset patch # User Chris Cannam # Date 1563455520 -3600 # Node ID a27a6113fdd78ac1bdbb869b7966b72f05740e13 # Parent 155008f1bf10b05443d0ee5ef3d312183028f646 Restore/reimplement cancelAsyncLayerCreation - I had forgotten Tony uses it diff -r 155008f1bf10 -r a27a6113fdd7 framework/Document.cpp --- a/framework/Document.cpp Wed Jul 17 14:25:41 2019 +0100 +++ b/framework/Document.cpp Thu Jul 18 14:12:00 2019 +0100 @@ -291,6 +291,12 @@ delete this; } + void cancel() { + foreach (Layer *layer, m_primary) { + m_doc->setModel(layer, {}); + } + } + private: Document *m_doc; vector m_primary; @@ -333,6 +339,13 @@ return amc; } +void +Document::cancelAsyncLayerCreation(Document::LayerCreationAsyncHandle h) +{ + AdditionalModelConverter *conv = static_cast(h); + conv->cancel(); +} + vector Document::createLayersForDerivedModels(vector newModels, QStringList names) diff -r 155008f1bf10 -r a27a6113fdd7 framework/Document.h --- a/framework/Document.h Wed Jul 17 14:25:41 2019 +0100 +++ b/framework/Document.h Thu Jul 18 14:12:00 2019 +0100 @@ -165,6 +165,14 @@ LayerCreationHandler *handler); /** + * Indicate that the async layer creation task associated with the + * given handle should be cancelled. There is no guarantee about + * what this will mean, and the handler callback may still be + * called. + */ + void cancelAsyncLayerCreation(LayerCreationAsyncHandle handle); + + /** * Delete the given layer, and also its associated model if no * longer used by any other layer. In general, this should be the * only method used to delete layers -- doing so directly is a bit