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