diff options
-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()); } |