aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <[email protected]>2014-10-30 22:30:01 +0100
committerSimon Hausmann <[email protected]>2014-10-31 15:42:42 +0100
commit0704d2be63b484cb579c1507223db3f914b1338a (patch)
tree66d4e616545d7f576125e85cc108c7e2988cecdd /src/qml/jsruntime/qv4qobjectwrapper.cpp
parente67948823d6810c2de784859da52a261bf80b550 (diff)
Get rid of !this and similar constructs
The C++ standard doesn't allow calling member functions on a mull object. Fix all such places, by moving the checks to the caller where required. Change-Id: I10fb22acaf0324d8ffd3a6d8e19152e5d32f56bb Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 32379f7f1e..f2c30e618f 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -650,9 +650,13 @@ void QObjectWrapper::setProperty(ExecutionContext *ctx, int propertyIndex, const
bool QObjectWrapper::isEqualTo(Managed *a, Managed *b)
{
- QV4::QObjectWrapper *qobjectWrapper = a->as<QV4::QObjectWrapper>();
- if (QV4::QmlTypeWrapper *qmlTypeWrapper = b->asObject()->as<QV4::QmlTypeWrapper>())
- return qmlTypeWrapper->toVariant().value<QObject*>() == qobjectWrapper->object();
+ Q_ASSERT(a->as<QV4::QObjectWrapper>());
+ QV4::QObjectWrapper *qobjectWrapper = static_cast<QV4::QObjectWrapper *>(a);
+ QV4::Object *o = b->asObject();
+ if (o) {
+ if (QV4::QmlTypeWrapper *qmlTypeWrapper = o->as<QV4::QmlTypeWrapper>())
+ return qmlTypeWrapper->toVariant().value<QObject*>() == qobjectWrapper->object();
+ }
return false;
}