From ee8589dd9a681a469511308345e4ef0b304aaaab Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 8 Nov 2019 11:35:30 +0100 Subject: instanceof: return false instead of throwing [ChangeLog][Important Behavior Changes] Using instanceof to check whether an instance has the type of QObject or one of its derived classes used to raise a TypeError, if the instance was not derived from QObject. Now, it instead returns false, which is more in line with the ECMAScript semantic. Fixes: QTBUG-79868 Change-Id: I0999807165eb36e7ebb888dce66238619a02a127 Reviewed-by: Qt CI Bot Reviewed-by: Ulf Hermann --- src/qml/qml/qqmltypewrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index ef4a628a04..fa5d36503d 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -400,7 +400,7 @@ ReturnedValue QQmlTypeWrapper::virtualInstanceOf(const Object *typeObject, const // can only compare a QObject* against a QML type const QObjectWrapper *wrapper = var.as(); if (!wrapper) - return engine->throwTypeError(); + return QV4::Encode(false); // in case the wrapper outlived the QObject* const QObject *wrapperObject = wrapper->object(); -- cgit v1.2.3