diff options
author | con <qtc-committer@nokia.com> | 2011-06-23 16:20:38 +0200 |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2011-06-23 16:28:05 +0200 |
commit | f3e22da48cb4ae1c8be48072c852a1a24e54f953 (patch) | |
tree | 1a4920502ec9d0635ed2123f5d92413fe2f32f5d /src/libs/aggregation | |
parent | 78fa1bb0aab0e14c6ee8c4ab33286c818bcc704e (diff) |
Remove some aggregation deadlocks.
You are not allowed to add components that belong to other aggregate
(including aggregates themselves). Warn in this case instead of locking
up.
Task-number: QTCREATORBUG-4926
Change-Id: I4908fb9019efbc2fa3b7c3c57e08cc1d7f8f3e2c
Reviewed-on: http://codereview.qt.nokia.com/679
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bill King <bill.king@nokia.com>
Diffstat (limited to 'src/libs/aggregation')
-rw-r--r-- | src/libs/aggregation/aggregate.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libs/aggregation/aggregate.cpp b/src/libs/aggregation/aggregate.cpp index 774752d0c8..f6e474109c 100644 --- a/src/libs/aggregation/aggregate.cpp +++ b/src/libs/aggregation/aggregate.cpp @@ -33,6 +33,7 @@ #include "aggregate.h" #include <QtCore/QWriteLocker> +#include <QtCore/QDebug> /*! \namespace Aggregation @@ -228,6 +229,8 @@ void Aggregate::deleteSelf(QObject *obj) \fn void Aggregate::add(QObject *component) Adds the \a component to the aggregate. + You can't add a component that is part of a different aggregate + or an aggregate itself. \sa Aggregate::remove() */ @@ -240,8 +243,10 @@ void Aggregate::add(QObject *component) Aggregate *parentAggregation = aggregateMap().value(component); if (parentAggregation == this) return; - if (parentAggregation) - parentAggregation->remove(component); + if (parentAggregation) { + qWarning() << "Cannot add a component that belongs to a different aggregate" << component; + return; + } m_components.append(component); connect(component, SIGNAL(destroyed(QObject*)), this, SLOT(deleteSelf(QObject*))); aggregateMap().insert(component, this); |