diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-16 10:14:40 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-09-16 13:13:04 (GMT) |
commit | 64017d5d8a431c100ae190567cfd815dce02b334 (patch) | |
tree | f16ccb54a612d4e8b9b3910a438e2cf38c3707f7 /src/corelib/kernel/qobject_p.h | |
parent | fc2ae0267e6ecbe9a641a44b953f6363beedb501 (diff) | |
download | Qt-64017d5d8a431c100ae190567cfd815dce02b334.zip Qt-64017d5d8a431c100ae190567cfd815dce02b334.tar.gz Qt-64017d5d8a431c100ae190567cfd815dce02b334.tar.bz2 |
Move QGuard to the ExtraData
not every QObject need a pointer to the QGuard while none of them will
usually use it (it is private API)
Reviewed-by: Thiago
Diffstat (limited to 'src/corelib/kernel/qobject_p.h')
-rw-r--r-- | src/corelib/kernel/qobject_p.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index e7d824b..eb8035c 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -99,11 +99,13 @@ class Q_CORE_EXPORT QObjectPrivate : public QObjectData public: struct ExtraData { + ExtraData() : objectGuards(0) {} #ifndef QT_NO_USERDATA QVector<QObjectUserData *> userData; #endif QList<QByteArray> propertyNames; QList<QVariant> propertyValues; + QGuard<QObject> *objectGuards; //linked list handle of QGuards }; struct Connection @@ -197,7 +199,6 @@ public: // these objects are all used to indicate that a QObject was deleted // plus QPointer, which keeps a separate list QDeclarativeData *declarativeData; - QGuard<QObject> *objectGuards; QAtomicPointer<QtSharedPointer::ExternalRefCountData> sharedRefcount; int *deleteWatch; }; @@ -211,9 +212,12 @@ inline void q_guard_addGuard(QGuard<QObject> *g) return; } - g->next = p->objectGuards; - p->objectGuards = g; - g->prev = &p->objectGuards; + if (!p->extraData) + p->extraData = new QObjectPrivate::ExtraData; + + g->next = p->extraData->objectGuards; + p->extraData->objectGuards = g; + g->prev = &p->extraData->objectGuards; if (g->next) g->next->prev = &g->next; } |