diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-10-21 09:43:21 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-10-21 09:19:01 +0000 |
commit | 6fd29da2cb6b7325631163bad1fdc79f0f71de77 (patch) | |
tree | 8359824ef3295cce41ba178fc59aa5e2a40463ec /src/plugins/projectexplorer/targetsettingspanel.cpp | |
parent | 1646c266d672fcbb77121f1c34a919207bce8e8b (diff) |
Target setup page: Un-queue connection to kit manager
If we have a project with two enabled targets and we remove both of the
associated kits, one of the targets temporarily becomes the active one.
If the activeTargetChanged() signal gets queued, then the receiver will
be called with an invalid target pointer, as the target has been removed
in the meantime.
It is unclear why the signal was queued in the first place. Presumably
the original reasoning is no longer applicable after various
refactorings.
This amends (and effectively reverts) commit c13b20f160.
Task-number: QTCREATORBUG-23075
Change-Id: I3c63c763319734a4d52b3bb221919b20fd123dbe
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/targetsettingspanel.cpp')
-rw-r--r-- | src/plugins/projectexplorer/targetsettingspanel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 3bb35bfe75d..e1345cb50ea 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -674,7 +674,7 @@ TargetGroupItem::TargetGroupItem(const QString &displayName, Project *project) QObject::connect(project, &Project::removedTarget, d.get(), &TargetGroupItemPrivate::handleTargetRemoved); QObject::connect(project, &Project::activeTargetChanged, - d.get(), &TargetGroupItemPrivate::handleTargetChanged, Qt::QueuedConnection); + d.get(), &TargetGroupItemPrivate::handleTargetChanged); } TargetGroupItem::~TargetGroupItem() = default; @@ -748,8 +748,10 @@ TargetItem *TargetGroupItem::currentTargetItem() const TargetItem *TargetGroupItem::targetItem(Target *target) const { - if (target) - return findFirstLevelChild([target](TargetItem *item) { return item->target() == target; }); + if (target) { + Id needle = target->id(); // Unconfigured project have no active target. + return findFirstLevelChild([needle](TargetItem *item) { return item->m_kitId == needle; }); + } return nullptr; } |