GH-2515 Save instance ID before display dialog

This commit is contained in:
janrupf 2019-06-17 16:45:32 +02:00 committed by Petr Mrázek
parent ce12f1a734
commit 1ed84eddd5
2 changed files with 3 additions and 2 deletions

View File

@ -234,7 +234,7 @@ void InstanceList::deleteInstance(const InstanceId& id)
auto inst = getInstanceById(id);
if(!inst)
{
qDebug() << "Cannot delete instance" << id << " No such instance is present.";
qDebug() << "Cannot delete instance" << id << ". No such instance is present (deleted externally?).";
return;
}

View File

@ -1664,6 +1664,7 @@ void MainWindow::on_actionDeleteInstance_triggered()
{
return;
}
auto id = m_selectedInstance->id();
auto response = CustomMessageBox::selectable(
this,
tr("CAREFUL!"),
@ -1674,7 +1675,7 @@ void MainWindow::on_actionDeleteInstance_triggered()
)->exec();
if (response == QMessageBox::Yes)
{
MMC->instances()->deleteInstance(m_selectedInstance->id());
MMC->instances()->deleteInstance(id);
}
}