Permalink
Browse files

GH-2485 fix crash bug while creating instances

  • Loading branch information...
peterix committed Dec 14, 2018
1 parent 075e173 commit 14bb666a207ee76cf302152aa03579a47ef32215
Showing with 6 additions and 8 deletions.
  1. +3 −5 api/logic/InstanceList.cpp
  2. +2 −2 application/MainWindow.cpp
  3. +1 −1 application/pages/instance/LegacyUpgradePage.cpp
@@ -718,17 +718,17 @@ Q_OBJECT
// FIXME/TODO: add ability to abort during instance commit retries
bool abort() override
{
if(m_child)
if(m_child && m_child->canAbort())
{
return m_child->abort();
}
return false;
}
bool canAbort() const override
{
if(m_child)
if(m_child && m_child->canAbort())
{
return m_child->canAbort();
return true;
}
return false;
}
@@ -746,7 +746,6 @@ Q_OBJECT
private slots:
void childSucceded()
{
m_child.reset();
unsigned sleepTime = backoff();
if(m_parent->commitStagedInstance(m_stagingPath, m_instanceName, m_groupName))
{
@@ -764,7 +763,6 @@ private slots:
}
void childFailed(const QString & reason)
{
m_child.reset();
m_parent->destroyStagingPath(m_stagingPath);
emitFailed(reason);
}
@@ -1283,7 +1283,7 @@ void MainWindow::runModalTask(Task *task)

void MainWindow::instanceFromInstanceTask(InstanceTask *rawTask)
{
std::unique_ptr<Task> task(MMC->instances()->wrapInstanceTask(rawTask));
unique_qobject_ptr<Task> task(MMC->instances()->wrapInstanceTask(rawTask));
runModalTask(task.get());
}

@@ -1300,7 +1300,7 @@ void MainWindow::on_actionCopyInstance_triggered()
copyTask->setName(copyInstDlg.instName());
copyTask->setGroup(copyInstDlg.instGroup());
copyTask->setIcon(copyInstDlg.iconKey());
std::unique_ptr<Task> task(MMC->instances()->wrapInstanceTask(copyTask));
unique_qobject_ptr<Task> task(MMC->instances()->wrapInstanceTask(copyTask));
runModalTask(task.get());
}

@@ -40,7 +40,7 @@ void LegacyUpgradePage::on_upgradeButton_clicked()
upgradeTask->setName(newName);
upgradeTask->setGroup(MMC->instances()->getInstanceGroup(m_inst->id()));
upgradeTask->setIcon(m_inst->iconKey());
std::unique_ptr<Task> task(MMC->instances()->wrapInstanceTask(upgradeTask));
unique_qobject_ptr<Task> task(MMC->instances()->wrapInstanceTask(upgradeTask));
runModalTask(task.get());
}

0 comments on commit 14bb666

Please sign in to comment.