From 03047888b59eb7c7fa196368f2a20b004348210a Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 30 May 2011 14:12:22 +0000 Subject: [PATCH] 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 Reviewed-by: Daniel Teske --- src/plugins/remotelinux/maemotoolchain.cpp | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) 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);