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/quick/items | |
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/quick/items')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquickview_p.h | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index d71f1da98f..dd9b66cabb 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -490,7 +490,7 @@ struct QQuickJSContext2D : public QV4::Object struct { QQuickContext2D* context; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static QV4::ReturnedValue method_get_globalAlpha(QV4::CallContext *ctx); static QV4::ReturnedValue method_set_globalAlpha(QV4::CallContext *ctx); @@ -538,7 +538,7 @@ DEFINE_OBJECT_VTABLE(QQuickJSContext2D); struct QQuickJSContext2DPrototype : public QV4::Object { - V4_OBJECT + V4_OBJECT(QV4::Object) public: static QQuickJSContext2DPrototype *create(QV4::ExecutionEngine *engine) { @@ -663,7 +663,7 @@ struct QQuickContext2DStyle : public QV4::Object bool patternRepeatY:1; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static QV4::ReturnedValue gradient_proto_addColorStop(QV4::CallContext *ctx); protected: @@ -887,7 +887,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object QImage image; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static void destroy(QV4::Managed *that) { static_cast<QQuickJSContext2DPixelData *>(that)->d()->~Data(); @@ -921,7 +921,7 @@ struct QQuickJSContext2DImageData : public QV4::Object struct { QV4::Value pixelData; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static QV4::ReturnedValue method_get_width(QV4::CallContext *ctx); static QV4::ReturnedValue method_get_height(QV4::CallContext *ctx); diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index 4666ed4d4b..f88f03f291 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -118,7 +118,7 @@ struct QQuickRootItemMarker : public QV4::Object QQuickWindow *window; } __data; - V4_OBJECT + V4_OBJECT(QV4::Object) static QQuickRootItemMarker *create(QQmlEngine *engine, QQuickWindow *window); |