diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2011-10-10 16:29:11 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-10 21:22:18 +0200 |
commit | d04a191e0284d9260ba8e0a12ed42038bef05a8b (patch) | |
tree | 8b0c7883c0650026d18bb1e2c982083ce360cb75 /src/script/api/qscriptstring.cpp | |
parent | 28b36b736dca643eaaf62bf52862f884fe256027 (diff) | |
download | qtscript-d04a191e0284d9260ba8e0a12ed42038bef05a8b.tar.gz |
Use QBasicAtomicInt load() and store() instead of implicit casting
The implicit casts will be unavailable in the near future.
Change-Id: I7305bed90fdcd50e910b207dc41caa8d34467c54
Reviewed-on: http://codereview.qt-project.org/6352
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/script/api/qscriptstring.cpp')
-rw-r--r-- | src/script/api/qscriptstring.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index 2930c9e..16e9096 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -71,9 +71,9 @@ QScriptString::QScriptString(const QScriptString &other) : d_ptr(other.d_ptr) { if (d_func() && (d_func()->type == QScriptStringPrivate::StackAllocated)) { - Q_ASSERT(d_func()->ref != 1); + Q_ASSERT(d_func()->ref.load() != 1); d_ptr.detach(); - d_func()->ref = 1; + d_func()->ref.store(1); d_func()->type = QScriptStringPrivate::HeapAllocated; d_func()->engine->registerScriptString(d_func()); } @@ -88,11 +88,11 @@ QScriptString::~QScriptString() if (d) { switch (d->type) { case QScriptStringPrivate::StackAllocated: - Q_ASSERT(d->ref == 1); + Q_ASSERT(d->ref.load() == 1); d->ref.ref(); // avoid deletion break; case QScriptStringPrivate::HeapAllocated: - if (d->engine && (d->ref == 1)) { + if (d->engine && (d->ref.load() == 1)) { // Make sure the identifier is removed from the correct engine. QScript::APIShim shim(d->engine); d->identifier = JSC::Identifier(); @@ -108,15 +108,15 @@ QScriptString::~QScriptString() */ QScriptString &QScriptString::operator=(const QScriptString &other) { - if (d_func() && d_func()->engine && (d_func()->ref == 1) && (d_func()->type == QScriptStringPrivate::HeapAllocated)) { + if (d_func() && d_func()->engine && (d_func()->ref.load() == 1) && (d_func()->type == QScriptStringPrivate::HeapAllocated)) { // current d_ptr will be deleted at the assignment below, so unregister it first d_func()->engine->unregisterScriptString(d_func()); } d_ptr = other.d_ptr; if (d_func() && (d_func()->type == QScriptStringPrivate::StackAllocated)) { - Q_ASSERT(d_func()->ref != 1); + Q_ASSERT(d_func()->ref.load() != 1); d_ptr.detach(); - d_func()->ref = 1; + d_func()->ref.store(1); d_func()->type = QScriptStringPrivate::HeapAllocated; d_func()->engine->registerScriptString(d_func()); } |