diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-11-28 10:40:52 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-11-28 12:00:08 +0000 |
commit | 12428bf1d67bd282c5276383c91d968451b44036 (patch) | |
tree | 3fd6c6b256552e0c5a5c35fbdb41a43427eb9559 /src/libs/aggregation | |
parent | 40d5a90bbcc2b7c48f2f27759f9aaac584bed5d5 (diff) |
Aggregation: Fix crash when components are in parent-child relationship
and the child is deleted first.
Change-Id: Idea3b4a3410bda99a8727551e2cbeab3a7b95d85
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src/libs/aggregation')
-rw-r--r-- | src/libs/aggregation/aggregate.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libs/aggregation/aggregate.cpp b/src/libs/aggregation/aggregate.cpp index 7be6437ae2..11d13907f3 100644 --- a/src/libs/aggregation/aggregate.cpp +++ b/src/libs/aggregation/aggregate.cpp @@ -193,6 +193,9 @@ void Aggregate::deleteSelf(QObject *obj) QWriteLocker locker(&lock()); aggregateMap().remove(obj); m_components.removeAll(obj); + // Avoid issues if obj was child of another component of the aggregate. + // The parent is deleted in ~Aggregate and might still have a reference on obj + obj->setParent({}); } delete this; } |