diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-06-13 16:04:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:20 +0200 |
commit | da9d5016613d04f002c6433e2b3083143fec34cb (patch) | |
tree | db73090d9a3c79c2cf777aecc35612faa9797194 /src/qml/types | |
parent | b393c405b7568e80628bc99501a9c53bbd0e678d (diff) |
Fix Managed::as<>() method
The as<> casting method was not doing the right thing
in 100% of the cases. It only checked if the object in
question was exactly of the type being asked for. It
however didn't check if the object was derived from the
type.
This commit fixes this by adding a parent chain to the
vtables, that is then being used to check this safely
at runtime.
Change-Id: I9e0b13adbda668aee8c7451e2bb71cd6d4e316d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 6 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p_p.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 7fd880681f..dfef707c97 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -78,7 +78,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg); } __data; - V4_OBJECT + V4_OBJECT(QV4::FunctionObject) static DelegateModelGroupFunction *create(QV4::ExecutionContext *scope, uint flag, QV4::ReturnedValue (*code)(QQmlDelegateModelItem *item, uint flag, const QV4::ValueRef arg)) { @@ -3226,7 +3226,7 @@ struct QQmlDelegateModelGroupChange : QV4::Object QQmlChangeSet::Change change; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static QQmlDelegateModelGroupChange *create(QV4::ExecutionEngine *e) { return e->memoryManager->alloc<QQmlDelegateModelGroupChange>(e); @@ -3276,7 +3276,7 @@ struct QQmlDelegateModelGroupChangeArray : public QV4::Object struct { QVector<QQmlChangeSet::Change> changes; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) public: static QQmlDelegateModelGroupChangeArray *create(QV4::ExecutionEngine *engine, const QVector<QQmlChangeSet::Change> &changes) { diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index e305ac1f3a..f9cbc428c1 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -175,7 +175,7 @@ struct QQmlDelegateModelItemObject : QV4::Object QQmlDelegateModelItem *item; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static void destroy(Managed *that); }; |