diff options
author | Thiago Macieira <thiago@kde.org> | 2011-07-05 23:46:19 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-03 07:57:41 +0200 |
commit | 5bfeab8749ce6820d55135b81665a7231d3b1504 (patch) | |
tree | 152569571114c53d4cdfaa0013307267cb3379a6 /src/corelib/kernel | |
parent | 5613c9722adee921e16682c0a035f2a7567bd346 (diff) |
Make all uses of QBasicAtomicInt and Pointer use load() and store()
Most of these changes are search-and-replace of d->ref ==, d->ref !=
and d->ref =.
The QBasicAtomicPointer in QObjectPrivate::Connection didn't need to
be basic, so I made it QAtomicPointer.
Change-Id: Ie3271abd1728af599f9ab17c6f4868e475f17bb6
Reviewed-on: http://codereview.qt-project.org/5030
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qobject_p.h | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 5df7658a13..f7473e337c 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -273,10 +273,10 @@ inline int qRegisterMetaTypeStreamOperators() static int qt_metatype_id() \ { \ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \ - if (!metatype_id) \ - metatype_id = qRegisterMetaType< TYPE >(#TYPE, \ - reinterpret_cast< TYPE *>(quintptr(-1))); \ - return metatype_id; \ + if (!metatype_id.load()) \ + metatype_id.storeRelease(qRegisterMetaType< TYPE >(#TYPE, \ + reinterpret_cast< TYPE *>(quintptr(-1)))); \ + return metatype_id.loadAcquire(); \ } \ }; \ QT_END_NAMESPACE diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 0d7b840c3e..6e539d1722 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -808,13 +808,13 @@ QObject::~QObject() } if (d->sharedRefcount) { - if (d->sharedRefcount->strongref > 0) { + if (d->sharedRefcount->strongref.load() > 0) { qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash."); // but continue deleting, it's too late to stop anyway } // indicate to all QWeakPointers that this QObject has now been deleted - d->sharedRefcount->strongref = 0; + d->sharedRefcount->strongref.store(0); if (!d->sharedRefcount->weakref.deref()) delete d->sharedRefcount; } diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index e7233c5ba9..b4c30bd149 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -120,7 +120,7 @@ public: //senders linked list Connection *next; Connection **prev; - QBasicAtomicPointer<int> argumentTypes; + QAtomicPointer<int> argumentTypes; ushort method_offset; ushort method_relative; ushort connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking |