From b85c2deccae3006468eaf3023d5b3bf802739747 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 1 Jul 2019 19:38:42 +0200 Subject: Port from implicit to explicit atomic operations The old code used the implicit conversions from QAtomicPointer to T*, and QAtomicInteger to T, and vice versa. The semantics of these differ from the ones std::atomic uses, so we're going to deprecate these, like we did for load() and store(), too. This patch fixes some users of these APIs before we deprecate them. Change-Id: I892d705c22280f1c6fdc62c1777248b44e9c4329 Reviewed-by: Ulf Hermann --- src/qml/jsapi/qjsengine.cpp | 6 +++--- src/qml/jsapi/qjsvalue.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/qml/jsapi') diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index 7bf2a4d004..1bfd72227f 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -490,7 +490,7 @@ void QJSEngine::setInterrupted(bool interrupted) */ bool QJSEngine::isInterrupted() const { - return m_v4Engine->isInterrupted; + return m_v4Engine->isInterrupted.loadAcquire(); } static QUrl urlForFileName(const QString &fileName) @@ -550,7 +550,7 @@ QJSValue QJSEngine::evaluate(const QString& program, const QString& fileName, in result = script.run(); if (scope.engine->hasException) result = v4->catchException(); - if (v4->isInterrupted) + if (v4->isInterrupted.loadAcquire()) result = v4->newErrorObject(QStringLiteral("Interrupted")); QJSValue retval(v4, result->asReturnedValue()); @@ -590,7 +590,7 @@ QJSValue QJSEngine::importModule(const QString &fileName) if (m_v4Engine->hasException) return QJSValue(m_v4Engine, m_v4Engine->catchException()); moduleUnit->evaluate(); - if (!m_v4Engine->isInterrupted) + if (!m_v4Engine->isInterrupted.loadAcquire()) return QJSValue(m_v4Engine, moduleNamespace->asReturnedValue()); return QJSValue( diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index 92eaf1d8ee..c2957dd294 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -769,7 +769,7 @@ QJSValue QJSValue::call(const QJSValueList &args) ScopedValue result(scope, f->call(jsCallData)); if (engine->hasException) result = engine->catchException(); - if (engine->isInterrupted) + if (engine->isInterrupted.loadAcquire()) result = engine->newErrorObject(QStringLiteral("Interrupted")); return QJSValue(engine, result->asReturnedValue()); @@ -827,7 +827,7 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList ScopedValue result(scope, f->call(jsCallData)); if (engine->hasException) result = engine->catchException(); - if (engine->isInterrupted) + if (engine->isInterrupted.loadAcquire()) result = engine->newErrorObject(QStringLiteral("Interrupted")); return QJSValue(engine, result->asReturnedValue()); @@ -877,7 +877,7 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args) ScopedValue result(scope, f->callAsConstructor(jsCallData)); if (engine->hasException) result = engine->catchException(); - if (engine->isInterrupted) + if (engine->isInterrupted.loadAcquire()) result = engine->newErrorObject(QStringLiteral("Interrupted")); return QJSValue(engine, result->asReturnedValue()); -- cgit v1.2.3