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/global/qglobal.h | |
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/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 2d2db2440d..228c9a3469 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1909,8 +1909,8 @@ public: inline ~QGlobalStaticDeleter() { - delete globalStatic.pointer; - globalStatic.pointer = 0; + delete globalStatic.pointer.load(); + globalStatic.pointer.store(0); globalStatic.destroyed = true; } }; @@ -1920,14 +1920,14 @@ public: { \ static QGlobalStatic<TYPE > thisGlobalStatic \ = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \ - if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \ + if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \ TYPE *x = new TYPE; \ if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \ delete x; \ else \ static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \ } \ - return thisGlobalStatic.pointer; \ + return thisGlobalStatic.pointer.load(); \ } #define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS) \ @@ -1935,14 +1935,14 @@ public: { \ static QGlobalStatic<TYPE > thisGlobalStatic \ = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \ - if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \ + if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \ TYPE *x = new TYPE ARGS; \ if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) \ delete x; \ else \ static QGlobalStaticDeleter<TYPE > cleanup(thisGlobalStatic); \ } \ - return thisGlobalStatic.pointer; \ + return thisGlobalStatic.pointer.load(); \ } #define Q_GLOBAL_STATIC_WITH_INITIALIZER(TYPE, NAME, INITIALIZER) \ @@ -1950,7 +1950,7 @@ public: { \ static QGlobalStatic<TYPE > thisGlobalStatic \ = { Q_BASIC_ATOMIC_INITIALIZER(0), false }; \ - if (!thisGlobalStatic.pointer && !thisGlobalStatic.destroyed) { \ + if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { \ QScopedPointer<TYPE > x(new TYPE); \ INITIALIZER; \ if (thisGlobalStatic.pointer.testAndSetOrdered(0, x.data())) { \ @@ -1958,7 +1958,7 @@ public: x.take(); \ } \ } \ - return thisGlobalStatic.pointer; \ + return thisGlobalStatic.pointer.load(); \ } #endif |