comparison main/MainWindow.cpp @ 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 a1c14880404b
comparison
equal deleted inserted replaced
2303:6df78d2b1b5e 2304:1bf8b93dc006
3512 return; 3512 return;
3513 } 3513 }
3514 3514
3515 SVDEBUG << "MainWindow::paneCancelButtonPressed: Layer " << layer << endl; 3515 SVDEBUG << "MainWindow::paneCancelButtonPressed: Layer " << layer << endl;
3516 3516
3517 // We need to ensure that the transform that is populating this
3518 // layer's model is stopped - that is the main reason to use
3519 // Cancel after all. It would also be a good idea to remove the
3520 // incomplete layer from both the view and the undo/redo stack.
3521
3522 // Deleting the target model will ensure that the transform gets
3523 // stopped, but removing the layer from the view is not enough to
3524 // delete the model, because a reference to the layer remains on
3525 // the undo/redo stack. If we also replace the model id with None
3526 // in the layer, that does the trick.
3527
3528 m_document->setModel(layer, {});
3517 m_document->removeLayerFromView(pane, layer); 3529 m_document->removeLayerFromView(pane, layer);
3530
3531 // We still have a layer with no model on the undo/redo stack,
3532 // which is a pity. I'm not sure we can easily remove it, since
3533 // other commands may have been pushed on the stack since, so
3534 // let's just leave that for now.
3535
3518 updateMenuStates(); 3536 updateMenuStates();
3519 } 3537 }
3520 3538
3521 void 3539 void
3522 MainWindow::paneDropAccepted(Pane *pane, QStringList uriList) 3540 MainWindow::paneDropAccepted(Pane *pane, QStringList uriList)