Commit a082365d authored by Daniel Teske's avatar Daniel Teske
Browse files

Fix crash on removing targets



Reported on irc.

Change-Id: I9e9911fff70c999158b941ab16918af03a51c728
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent def8f9f9
......@@ -177,17 +177,20 @@ bool Project::removeTarget(Target *target)
if (bm->isBuilding(target))
return false;
emit aboutToRemoveTarget(target);
d->m_targets.removeOne(target);
emit removedTarget(target);
if (target == activeTarget()) {
if (d->m_targets.isEmpty())
if (d->m_targets.size() == 1) {
setActiveTarget(0);
else
} else if (d->m_targets.first() == target) {
setActiveTarget(d->m_targets.at(1));
} else {
setActiveTarget(d->m_targets.at(0));
}
}
emit aboutToRemoveTarget(target);
d->m_targets.removeOne(target);
emit removedTarget(target);
delete target;
return true;
}
......
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