Commit 3ea963bd authored by Daniel Teske's avatar Daniel Teske

QtOptionsPage: Fix some more crashes

Since QtVersionItem owns the version, deleting it deletes
the version too. Also ensure that we first set the new version
in the item before updating the ui and then delete the old version.

Task-number: QTCREATORBUG-15004
Change-Id: I27014589f8eeb1c188a189ed4a7f92a4d2ac3bc1
Reviewed-by: default avatarUlf Hermann <ulf.hermann@theqtcompany.com>
parent b961955f
......@@ -393,7 +393,6 @@ void QtOptionsPageWidget::cleanUpQtVersions()
foreach (QtVersionItem *item, toRemove) {
m_model->takeItem(item);
delete item->version();
delete item;
}
......@@ -686,7 +685,6 @@ void QtOptionsPageWidget::updateQtVersions(const QList<int> &additions, const QL
// Remove changed/removed items:
foreach (QtVersionItem *item, toRemove) {
m_model->takeItem(item);
delete item->version();
delete item;
}
......@@ -787,7 +785,6 @@ void QtOptionsPageWidget::removeQtDir()
return;
m_model->takeItem(item);
delete item->version();
delete item;
updateCleanUpButton();
......@@ -822,14 +819,15 @@ void QtOptionsPageWidget::editPath()
version->setId(current->uniqueId());
if (current->unexpandedDisplayName() != current->defaultUnexpandedDisplayName(current->qmakeCommand()))
version->setUnexpandedDisplayName(current->displayName());
delete current;
// Update ui
userChangedCurrentVersion();
QtVersionItem *item = currentItem();
item->setVersion(version);
item->setToolChainId(defaultToolChainId(version));
item->setIcon(version->isValid()? m_validVersionIcon : m_invalidVersionIcon);
userChangedCurrentVersion();
delete current;
}
void QtOptionsPageWidget::updateDebuggingHelperUi()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment