changeset 2304:1bf8b93dc006 by-id

Fix failure to stop transform when Cancel clicked
author Chris Cannam
date Wed, 17 Jul 2019 11:20:50 +0100
parents 6df78d2b1b5e
children 332df8c4562b
files main/MainWindow.cpp repoint-lock.json
diffstat 2 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Jul 15 14:13:40 2019 +0100
+++ b/main/MainWindow.cpp	Wed Jul 17 11:20:50 2019 +0100
@@ -3514,7 +3514,25 @@
 
     SVDEBUG << "MainWindow::paneCancelButtonPressed: Layer " << layer << endl;
 
+    // We need to ensure that the transform that is populating this
+    // layer's model is stopped - that is the main reason to use
+    // Cancel after all. It would also be a good idea to remove the
+    // incomplete layer from both the view and the undo/redo stack.
+
+    // Deleting the target model will ensure that the transform gets
+    // stopped, but removing the layer from the view is not enough to
+    // delete the model, because a reference to the layer remains on
+    // the undo/redo stack. If we also replace the model id with None
+    // in the layer, that does the trick.
+    
+    m_document->setModel(layer, {});
     m_document->removeLayerFromView(pane, layer);
+
+    // We still have a layer with no model on the undo/redo stack,
+    // which is a pity. I'm not sure we can easily remove it, since
+    // other commands may have been pushed on the stack since, so
+    // let's just leave that for now.
+    
     updateMenuStates();
 }
 
--- a/repoint-lock.json	Mon Jul 15 14:13:40 2019 +0100
+++ b/repoint-lock.json	Wed Jul 17 11:20:50 2019 +0100
@@ -4,13 +4,13 @@
       "pin": "62987b6d6a3b"
     },
     "svcore": {
-      "pin": "110f853c3149"
+      "pin": "d1e2062cbdec"
     },
     "svgui": {
-      "pin": "3943d0720167"
+      "pin": "b43ff1abdc02"
     },
     "svapp": {
-      "pin": "c8ba09756eff"
+      "pin": "ad5917362158"
     },
     "checker": {
       "pin": "c8c17e51aab0"