Fixes: Crash after deleting a qt version and pressing cancel.

Details:  That hasn't worked in the last few months, since we changed
the QtVersion class from being passed by value to being passed around by
reference.
This commit is contained in:
dt
2009-02-04 16:55:01 +01:00
parent 4acbcc7606
commit eab0ff8f6e
2 changed files with 16 additions and 3 deletions

View File

@@ -177,7 +177,10 @@ void QtVersionManager::apply()
}
}
}
m_versions = m_widget->versions();
qDeleteAll(m_versions);
m_versions.clear();
foreach(QtVersion *version, m_widget->versions())
m_versions.append(new QtVersion(*version));
if (versionPathsChanged)
updateDocumentation();
updateUniqueIdToIndexMap();
@@ -361,11 +364,16 @@ QtVersion *QtVersionManager::currentQtVersion() const
QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defaultVersion)
: QWidget(parent)
, m_versions(versions)
, m_defaultVersion(defaultVersion)
, m_specifyNameString(tr("<specify a name>"))
, m_specifyPathString(tr("<specify a path>"))
{
// Initialize m_versions
foreach(QtVersion *version, versions) {
m_versions.append(new QtVersion(*version));
}
m_ui.setupUi(this);
m_ui.qtPath->setExpectedKind(Core::Utils::PathChooser::Directory);
m_ui.qtPath->setPromptDialogTitle(tr("Select QTDIR"));
@@ -417,6 +425,11 @@ QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defau
updateState();
}
QtDirWidget::~QtDirWidget()
{
qDeleteAll(m_versions);
}
void QtDirWidget::addQtDir()
{
QtVersion *newVersion = new QtVersion(m_specifyNameString, m_specifyPathString);

View File

@@ -122,7 +122,6 @@ private:
// This is updated on first call to qmakeCommand
// That function is called from updateVersionInfo()
mutable QString m_qtVersionString;
Q_DISABLE_COPY(QtVersion);
};
@@ -131,6 +130,7 @@ class QtDirWidget : public QWidget
Q_OBJECT
public:
QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defaultVersion);
~QtDirWidget();
QList<QtVersion *> versions() const;
int defaultVersion() const;
void finish();