aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-06-13 16:04:39 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-22 13:49:20 +0200
commitda9d5016613d04f002c6433e2b3083143fec34cb (patch)
treedb73090d9a3c79c2cf777aecc35612faa9797194 /src/qml/jsruntime/qv4context_p.h
parentb393c405b7568e80628bc99501a9c53bbd0e678d (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/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 10a86dd898..7d816f947e 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -133,7 +133,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
int lineNumber;
} __data;
- V4_MANAGED
+ V4_MANAGED(Managed)
Q_MANAGED_TYPE(ExecutionContext)
ExecutionContext(ExecutionEngine *engine, ContextType t)
@@ -208,7 +208,7 @@ struct CallContext : public ExecutionContext
Value *locals;
Object *activation;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
// formals are in reverse order
String * const *formals() const;
@@ -233,7 +233,7 @@ struct GlobalContext : public ExecutionContext
struct {
Object *global;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
};
@@ -248,7 +248,7 @@ struct CatchContext : public ExecutionContext
StringValue exceptionVarName;
Value exceptionValue;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
};
struct WithContext : public ExecutionContext
@@ -260,7 +260,7 @@ struct WithContext : public ExecutionContext
struct {
Object *withObject;
} __data;
- V4_MANAGED
+ V4_MANAGED(ExecutionContext)
};
inline CallContext *ExecutionContext::asCallContext()