summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-30 06:04:47 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-31 02:00:40 (GMT)
commit025dcc2bb9651708d456a5b1e5d2888e67d67bf4 (patch)
treec8253b752a6a96e738a68d8ab7ac5f3022f7161f
parentb859422e23a31af1cda5011883d8a25c934cea65 (diff)
downloadQt-025dcc2bb9651708d456a5b1e5d2888e67d67bf4.zip
Qt-025dcc2bb9651708d456a5b1e5d2888e67d67bf4.tar.gz
Qt-025dcc2bb9651708d456a5b1e5d2888e67d67bf4.tar.bz2
Add a declarative data ptr to QObjectPrivate
This data ptr does not increase the size of the QObject, as we take advantage of space otherwise only used during destruction. Reviewed-by: Andreas
-rw-r--r--src/corelib/kernel/qobject.cpp8
-rw-r--r--src/corelib/kernel/qobject_p.h12
2 files changed, 19 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index a1702d9..b0ddd81 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -842,6 +842,14 @@ QObject::~QObject()
d->eventFilters.clear();
+ // As declarativeData is in a union with currentChildBeingDeleted, this must
+ // be done (and declarativeData set back to 0) before deleting children.
+ if(d->declarativeData) {
+ QDeclarativeData *dd = d->declarativeData;
+ d->declarativeData = 0;
+ dd->destroyed(this);
+ }
+
if (!d->children.isEmpty())
d->deleteChildren();
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 54c98ad..19df642 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -86,6 +86,13 @@ inline QObjectData::~QObjectData() {}
enum { QObjectPrivateVersion = QT_VERSION };
+class QDeclarativeData
+{
+public:
+ virtual ~QDeclarativeData() {}
+ virtual void destroyed(QObject *) {}
+};
+
class Q_CORE_EXPORT QObjectPrivate : public QObjectData
{
Q_DECLARE_PUBLIC(QObject)
@@ -118,7 +125,10 @@ public:
// object currently activating the object
Sender *currentSender;
- QObject *currentChildBeingDeleted;
+ union {
+ QObject *currentChildBeingDeleted;
+ QDeclarativeData *declarativeData;
+ };
bool isSender(const QObject *receiver, const char *signal) const;
QObjectList receiverList(const char *signal) const;