Fix maemo tool chain creation on Qt version changes

Make sure the old maemo tool chain is removed before adding it
again.

Change-Id: Iecb77455c21962a25576fca39d32bb35fe638722
Reviewed-on: http://codereview.qt.nokia.com/227
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Tobias Hunger
2011-05-30 14:12:22 +00:00
parent cf62837fab
commit 03047888b5

View File

@@ -304,19 +304,20 @@ QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::createToolChainList(c
foreach (int i, changes) { foreach (int i, changes) {
QtSupport::BaseQtVersion *v = vm->version(i); QtSupport::BaseQtVersion *v = vm->version(i);
if (!v || !v->isValid()) { // remove tool chain (on removal, change or addition:
// remove tool chain: QList<ProjectExplorer::ToolChain *> toRemove;
QList<ProjectExplorer::ToolChain *> toRemove; foreach (ProjectExplorer::ToolChain *tc, tcm->toolChains()) {
foreach (ProjectExplorer::ToolChain *tc, tcm->toolChains()) { if (!tc->id().startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID)))
if (!tc->id().startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID))) continue;
continue; MaemoToolChain *mTc = static_cast<MaemoToolChain *>(tc);
MaemoToolChain *mTc = static_cast<MaemoToolChain *>(tc); if (mTc->qtVersionId() == i)
if (mTc->qtVersionId() == i) toRemove.append(mTc);
toRemove.append(mTc); }
} foreach (ProjectExplorer::ToolChain *tc, toRemove)
foreach (ProjectExplorer::ToolChain *tc, toRemove) tcm->deregisterToolChain(tc);
tcm->deregisterToolChain(tc);
} else if (MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(v)) { // (Re-)add toolchain:
if (MaemoQtVersion *mqv = dynamic_cast<MaemoQtVersion *>(v)) {
// add tool chain: // add tool chain:
MaemoToolChain *mTc = new MaemoToolChain(true); MaemoToolChain *mTc = new MaemoToolChain(true);
mTc->setQtVersionId(i); mTc->setQtVersionId(i);