diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-09-29 11:50:08 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-27 18:57:38 +0200 |
commit | 6476ac738ca029af95932f53b53f0705808eb80e (patch) | |
tree | d1884397040eb65d23a48a0e1a56dad3f476cf34 /src/gui | |
parent | 434824aede28e8c36d6991aa218f89daf2cc22fa (diff) | |
download | qtbase-6476ac738ca029af95932f53b53f0705808eb80e.tar.gz |
Replace implicit QAtomic* casts with explicit load()/store()
Change-Id: Ia7ef1a8e01001f203e409c710c977d6f4686342e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qimage.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 10 | ||||
-rw-r--r-- | src/gui/kernel/qevent.cpp | 36 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qpalette.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qsurfaceformat.cpp | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qbrush.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qbrush.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpen.cpp | 7 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 31 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 5 | ||||
-rw-r--r-- | src/gui/text/qglyphrun.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qplatformfontdatabase_qpa.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qrawfont.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qrawfont_p.h | 2 | ||||
-rw-r--r-- | src/gui/text/qstatictext.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 2 |
22 files changed, 68 insertions, 71 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index c74b715f8d..a19b608216 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1075,10 +1075,10 @@ QImage::operator QVariant() const void QImage::detach() { if (d) { - if (d->is_cached && d->ref == 1) + if (d->is_cached && d->ref.load() == 1) QImagePixmapCleanupHooks::executeImageHooks(cacheKey()); - if (d->ref != 1 || d->ro_data) + if (d->ref.load() != 1 || d->ro_data) *this = copy(); if (d) @@ -5289,7 +5289,7 @@ qint64 QImage::cacheKey() const bool QImage::isDetached() const { - return d && d->ref == 1; + return d && d->ref.load() == 1; } @@ -5849,7 +5849,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla return true; // No in-place conversion if we have to detach - if (ref > 1) + if (ref.load() > 1) return false; const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat]; diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 5d79f3fe22..dfc84c56d8 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -226,7 +226,7 @@ void QPicture::detach() bool QPicture::isDetached() const { - return d_func()->ref == 1; + return d_func()->ref.load() == 1; } /*! diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c025aa9283..2a2bd5d6fa 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -272,7 +272,7 @@ QPixmap::QPixmap(const char * const xpm[]) QPixmap::~QPixmap() { - Q_ASSERT(!data || data->ref >= 1); // Catch if ref-counting changes again + Q_ASSERT(!data || data->ref.load() >= 1); // Catch if ref-counting changes again } /*! @@ -871,7 +871,7 @@ void QPixmap::fill(const QColor &color) return; } - if (data->ref == 1) { + if (data->ref.load() == 1) { // detach() will also remove this pixmap from caches, so // it has to be called even when ref == 1. detach(); @@ -1000,7 +1000,7 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap) bool QPixmap::isDetached() const { - return data && data->ref == 1; + return data && data->ref.load() == 1; } /*! \internal @@ -1529,10 +1529,10 @@ void QPixmap::detach() rasterData->image.detach(); } - if (data->is_cached && data->ref == 1) + if (data->is_cached && data->ref.load() == 1) QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data()); - if (data->ref != 1) { + if (data->ref.load() != 1) { *this = copy(); } ++data->detach_no; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index c9e49ef700..ba81e5512c 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3761,7 +3761,7 @@ qreal QTouchEvent::TouchPoint::pressure() const /*! \internal */ void QTouchEvent::TouchPoint::setId(int id) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->id = id; } @@ -3769,7 +3769,7 @@ void QTouchEvent::TouchPoint::setId(int id) /*! \internal */ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->state = state; } @@ -3777,7 +3777,7 @@ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state) /*! \internal */ void QTouchEvent::TouchPoint::setPos(const QPointF &pos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->rect.moveCenter(pos); } @@ -3785,7 +3785,7 @@ void QTouchEvent::TouchPoint::setPos(const QPointF &pos) /*! \internal */ void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->sceneRect.moveCenter(scenePos); } @@ -3793,7 +3793,7 @@ void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos) /*! \internal */ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->screenRect.moveCenter(screenPos); } @@ -3801,7 +3801,7 @@ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos) /*! \internal */ void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->normalizedPos = normalizedPos; } @@ -3809,7 +3809,7 @@ void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos) /*! \internal */ void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->startPos = startPos; } @@ -3817,7 +3817,7 @@ void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos) /*! \internal */ void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->startScenePos = startScenePos; } @@ -3825,7 +3825,7 @@ void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos) /*! \internal */ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->startScreenPos = startScreenPos; } @@ -3833,7 +3833,7 @@ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos) /*! \internal */ void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->startNormalizedPos = startNormalizedPos; } @@ -3841,7 +3841,7 @@ void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormaliz /*! \internal */ void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->lastPos = lastPos; } @@ -3849,7 +3849,7 @@ void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos) /*! \internal */ void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->lastScenePos = lastScenePos; } @@ -3857,7 +3857,7 @@ void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos) /*! \internal */ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->lastScreenPos = lastScreenPos; } @@ -3865,7 +3865,7 @@ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos) /*! \internal */ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->lastNormalizedPos = lastNormalizedPos; } @@ -3873,7 +3873,7 @@ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalized /*! \internal */ void QTouchEvent::TouchPoint::setRect(const QRectF &rect) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->rect = rect; } @@ -3881,7 +3881,7 @@ void QTouchEvent::TouchPoint::setRect(const QRectF &rect) /*! \internal */ void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->sceneRect = sceneRect; } @@ -3889,7 +3889,7 @@ void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect) /*! \internal */ void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->screenRect = screenRect; } @@ -3897,7 +3897,7 @@ void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect) /*! \internal */ void QTouchEvent::TouchPoint::setPressure(qreal pressure) { - if (d->ref != 1) + if (d->ref.load() != 1) d = d->detach(); d->pressure = pressure; } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 2b42aaa119..6ea502b70b 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1600,7 +1600,7 @@ bool QKeySequence::operator< (const QKeySequence &other) const */ bool QKeySequence::isDetached() const { - return d->ref == 1; + return d->ref.load() == 1; } /*! diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index b3ce22448d..2b2f13e4bd 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -544,7 +544,7 @@ QOpenGLMultiGroupSharedResource::~QOpenGLMultiGroupSharedResource() active.deref(); } #ifndef QT_NO_DEBUG - if (active != 0) { + if (active.load() != 0) { qWarning("QtGui: Resources are still available at program shutdown.\n" " This is possibly caused by a leaked QOpenGLWidget, \n" " QOpenGLFramebufferObject or QOpenGLPixelBuffer."); diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index f84a366781..893cc5eff6 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -753,7 +753,7 @@ bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const */ void QPalette::detach() { - if (d->ref != 1) { + if (d->ref.load() != 1) { QPalettePrivate *x = new QPalettePrivate; for(int grp = 0; grp < (int)NColorGroups; grp++) { for(int role = 0; role < (int)NColorRoles; role++) diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 6326033ff2..33b04cc708 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -120,7 +120,7 @@ QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) : */ void QSurfaceFormat::detach() { - if (d->ref != 1) { + if (d->ref.load() != 1) { QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d); if (!d->ref.deref()) delete d; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index f08cab81d6..5e7f527c88 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE */ void QOpenGLFramebufferObjectFormat::detach() { - if (d->ref != 1) { + if (d->ref.load() != 1) { QOpenGLFramebufferObjectFormatPrivate *newd = new QOpenGLFramebufferObjectFormatPrivate(d); if (!d->ref.deref()) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d1130a8812..b4aa27db2f 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -343,7 +343,7 @@ public: QBrushData *brush; QNullBrushData() : brush(new QBrushData) { - brush->ref = 1; + brush->ref.store(1); brush->style = Qt::BrushStyle(0); brush->color = Qt::black; } @@ -402,7 +402,7 @@ void QBrush::init(const QColor &color, Qt::BrushStyle style) d.reset(new QBrushData); break; } - d->ref = 1; + d->ref.store(1); d->style = style; d->color = color; } @@ -577,7 +577,7 @@ void QBrush::cleanUp(QBrushData *x) void QBrush::detach(Qt::BrushStyle newStyle) { - if (newStyle == d->style && d->ref == 1) + if (newStyle == d->style && d->ref.load() == 1) return; QScopedPointer<QBrushData> x; @@ -605,7 +605,7 @@ void QBrush::detach(Qt::BrushStyle newStyle) x.reset(new QBrushData); break; } - x->ref = 1; + x->ref.store(1); x->style = newStyle; x->color = d->color; x->transform = d->transform; diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 80d9b43f1f..daad47cb19 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -174,7 +174,7 @@ inline Qt::BrushStyle QBrush::style() const { return d->style; } inline const QColor &QBrush::color() const { return d->color; } inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); } inline QTransform QBrush::transform() const { return d->transform; } -inline bool QBrush::isDetached() const { return d->ref == 1; } +inline bool QBrush::isDetached() const { return d->ref.load() == 1; } /******************************************************************************* diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index a2dfed63c8..9dc435f630 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -419,7 +419,7 @@ inline void QPainterPath::setElementPositionAt(int i, qreal x, qreal y) inline void QPainterPath::detach() { - if (d_ptr->ref != 1) + if (d_ptr->ref.load() != 1) detach_helper(); setDirty(true); } diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 1b5da7ee17..93cc11c8ee 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -245,7 +245,7 @@ inline bool QPainterPathData::isClosed() const inline void QPainterPathData::close() { - Q_ASSERT(ref == 1); + Q_ASSERT(ref.load() == 1); require_moveTo = true; const QPainterPath::Element &first = elements.at(cStart); QPainterPath::Element &last = elements.last(); diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a79e3a0cd2..5a4582e31e 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -230,10 +230,9 @@ typedef QPenPrivate QPenData; */ inline QPenPrivate::QPenPrivate(const QBrush &_brush, qreal _width, Qt::PenStyle penStyle, Qt::PenCapStyle _capStyle, Qt::PenJoinStyle _joinStyle) - : dashOffset(0), miterLimit(2), + : ref(1), dashOffset(0), miterLimit(2), cosmetic(false) { - ref = 1; width = _width; brush = _brush; style = penStyle; @@ -353,7 +352,7 @@ QPen::~QPen() void QPen::detach() { - if (d->ref == 1) + if (d->ref.load() == 1) return; QPenData *x = new QPenData(*static_cast<QPenData *>(d)); @@ -860,7 +859,7 @@ bool QPen::operator==(const QPen &p) const bool QPen::isDetached() { - return d->ref == 1; + return d->ref.load() == 1; } diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 7cd9fb15e9..23fe5ca4fb 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -667,7 +667,7 @@ QFont::QFont(QFontPrivate *data) */ void QFont::detach() { - if (d->ref == 1) { + if (d->ref.load() == 1) { if (d->engineData) d->engineData->ref.deref(); d->engineData = 0; @@ -2631,11 +2631,11 @@ QFontCache::~QFontCache() EngineDataCache::ConstIterator it = engineDataCache.constBegin(), end = engineDataCache.constEnd(); while (it != end) { - if (it.value()->ref == 0) + if (it.value()->ref.load() == 0) delete it.value(); else FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d", - it.value(), int(it.value()->ref)); + it.value(), it.value()->ref.load()); ++it; } } @@ -2643,7 +2643,7 @@ QFontCache::~QFontCache() end = engineCache.constEnd(); while (it != end) { if (--it.value().data->cache_count == 0) { - if (it.value().data->ref == 0) { + if (it.value().data->ref.load() == 0) { FC_DEBUG("QFontCache::~QFontCache: deleting engine %p key=(%d / %g %g %d %d %d)", it.value().data, it.key().script, it.key().def.pointSize, it.key().def.pixelSize, it.key().def.weight, it.key().def.style, @@ -2652,7 +2652,7 @@ QFontCache::~QFontCache() delete it.value().data; } else { FC_DEBUG("QFontCache::~QFontCache: engine = %p still has refcount %d", - it.value().data, int(it.value().data->ref)); + it.value().data, it.value().data->ref.load()); } } ++it; @@ -2678,7 +2678,7 @@ void QFontCache::clear() for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); it != end; ++it) { - if (it->data->ref == 0) { + if (it->data->ref.load() == 0) { delete it->data; it->data = 0; } @@ -2686,7 +2686,7 @@ void QFontCache::clear() for (EngineCache::Iterator it = engineCache.begin(), end = engineCache.end(); it != end; ++it) { - if (it->data && it->data->ref == 0) { + if (it->data && it->data->ref.load() == 0) { delete it->data; it->data = 0; } @@ -2727,7 +2727,7 @@ QFontEngine *QFontCache::findEngine(const Key &key) FC_DEBUG("QFontCache: found font engine\n" " %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'", it.value().data, it.value().timestamp, it.value().hits, - int(it.value().data->ref), it.value().data->cache_count, + it.value().data->ref.load(), it.value().data->cache_count, it.value().data->name()); return it.value().data; @@ -2782,7 +2782,6 @@ void QFontCache::decreaseCost(uint cost) cost, total_cost, max_cost); } - void QFontCache::timerEvent(QTimerEvent *) { FC_DEBUG("QFontCache::timerEvent: performing cache maintenance (timestamp %u)", @@ -2816,7 +2815,7 @@ void QFontCache::timerEvent(QTimerEvent *) #endif // QFONTCACHE_DEBUG - if (it.value()->ref != 0) + if (it.value()->ref.load() != 0) in_use_cost += engine_data_cost; } } @@ -2829,10 +2828,10 @@ void QFontCache::timerEvent(QTimerEvent *) for (; it != end; ++it) { FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, cost %u bytes", it.value().data, it.value().timestamp, it.value().hits, - int(it.value().data->ref), it.value().data->cache_count, + it.value().data->ref.load(), it.value().data->cache_count, it.value().data->cache_cost); - if (it.value().data->ref != 0) + if (it.value().data->ref.load() != 0) in_use_cost += it.value().data->cache_cost / it.value().data->cache_count; } @@ -2882,7 +2881,7 @@ void QFontCache::timerEvent(QTimerEvent *) EngineDataCache::Iterator it = engineDataCache.begin(), end = engineDataCache.end(); while (it != end) { - if (it.value()->ref != 0) { + if (it.value()->ref.load() != 0) { ++it; continue; } @@ -2910,7 +2909,7 @@ void QFontCache::timerEvent(QTimerEvent *) uint least_popular = ~0u; for (; it != end; ++it) { - if (it.value().data->ref != 0) + if (it.value().data->ref.load() != 0) continue; if (it.value().timestamp < oldest && @@ -2923,7 +2922,7 @@ void QFontCache::timerEvent(QTimerEvent *) FC_DEBUG(" oldest %u least popular %u", oldest, least_popular); for (it = engineCache.begin(); it != end; ++it) { - if (it.value().data->ref == 0 && + if (it.value().data->ref.load() == 0 && it.value().timestamp == oldest && it.value().hits == least_popular) break; @@ -2932,7 +2931,7 @@ void QFontCache::timerEvent(QTimerEvent *) if (it != end) { FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", it.value().data, it.value().timestamp, it.value().hits, - int(it.value().data->ref), it.value().data->cache_count, + it.value().data->ref.load(), it.value().data->cache_count, it.value().data->name()); if (--it.value().data->cache_count == 0) { diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 3f008064e2..067a630d4d 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -168,9 +168,8 @@ static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB // QFontEngine QFontEngine::QFontEngine() - : QObject() + : QObject(), ref(0) { - ref = 0; cache_count = 0; fsType = 0; symbol = false; @@ -1360,7 +1359,7 @@ QFontEngineMulti::~QFontEngineMulti() QFontEngine *fontEngine = engines.at(i); if (fontEngine) { fontEngine->ref.deref(); - if (fontEngine->cache_count == 0 && fontEngine->ref == 0) + if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0) delete fontEngine; } } diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 0457202a18..2ab339e388 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -138,7 +138,7 @@ QGlyphRun::~QGlyphRun() */ void QGlyphRun::detach() { - if (d->ref != 1) + if (d->ref.load() != 1) d.detach(); } diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index 80ad31cea3..8d5a9201d9 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -194,7 +194,7 @@ QSupportedWritingSystems::~QSupportedWritingSystems() */ void QSupportedWritingSystems::detach() { - if (d->ref != 1) { + if (d->ref.load() != 1) { QWritingSystemsPrivate *newd = new QWritingSystemsPrivate(d); if (!d->ref.deref()) delete d; diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 389c5bdc75..8fccd9b0ca 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -683,7 +683,7 @@ void QRawFont::setPixelSize(qreal pixelSize) d->fontEngine->ref.ref(); oldFontEngine->ref.deref(); - if (oldFontEngine->cache_count == 0 && oldFontEngine->ref == 0) + if (oldFontEngine->cache_count == 0 && oldFontEngine->ref.load() == 0) delete oldFontEngine; } @@ -695,7 +695,7 @@ void QRawFontPrivate::cleanUp() platformCleanUp(); if (fontEngine != 0) { fontEngine->ref.deref(); - if (fontEngine->cache_count == 0 && fontEngine->ref == 0) + if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0) delete fontEngine; fontEngine = 0; } diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index 1f2e957906..992cb2f720 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -84,7 +84,7 @@ public: ~QRawFontPrivate() { - Q_ASSERT(ref == 0); + Q_ASSERT(ref.load() == 0); cleanUp(); } diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index bed0da62da..a52cf25a98 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -177,7 +177,7 @@ QStaticText::QStaticText(const QStaticText &other) */ QStaticText::~QStaticText() { - Q_ASSERT(!data || data->ref >= 1); + Q_ASSERT(!data || data->ref.load() >= 1); } /*! @@ -185,7 +185,7 @@ QStaticText::~QStaticText() */ void QStaticText::detach() { - if (data->ref != 1) + if (data->ref.load() != 1) data.detach(); } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 3a2431d1ea..08d3a4df6e 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1219,7 +1219,7 @@ static inline void releaseCachedFontEngine(QFontEngine *fontEngine) { if (fontEngine) { fontEngine->ref.deref(); - if (fontEngine->cache_count == 0 && fontEngine->ref == 0) + if (fontEngine->cache_count == 0 && fontEngine->ref.load() == 0) delete fontEngine; } } |