Fix a crash.

If call a visualization and then close the window Valentina will crash.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-11 15:02:52 +03:00
parent b63922fa9e
commit fdd3e9a70c
2 changed files with 2 additions and 1 deletions

View File

@ -1913,6 +1913,7 @@ void MainWindow::CancelTool()
currentScene->setFocus(Qt::OtherFocusReason); currentScene->setFocus(Qt::OtherFocusReason);
currentScene->clearSelection(); currentScene->clearSelection();
ui->view->itemClicked(nullptr); // Hide visualization to avoid a crash
switch ( currentTool ) switch ( currentTool )
{ {

View File

@ -187,7 +187,7 @@ inline void VAbstractTool::AddVisualization()
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor); connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
scene->addItem(visual); scene->addItem(visual);
connect(visual, &Visualization::ToolTip, RECEIVER(this)[this] (const QString &toolTip) {emit ToolTip(toolTip);}); connect(visual, &Visualization::ToolTip, this, &VAbstractTool::ToolTip);
vis = visual; vis = visual;
} }