Fix Context::getPropertyAndBase to use Heap based objects
authorLars Knoll <lars.knoll@digia.com>
Tue, 2 Dec 2014 11:46:20 +0000 (12:46 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Sat, 20 Dec 2014 09:07:39 +0000 (10:07 +0100)
Change-Id: I4f885a8af5e963445959871b7f26f3bcb3dfa654
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/qml/jsruntime/qv4context.cpp
src/qml/jsruntime/qv4context_p.h
src/qml/jsruntime/qv4runtime.cpp

index 3c36612..001a586 100644 (file)
@@ -404,11 +404,11 @@ ReturnedValue ExecutionContext::getProperty(String *name)
     return engine()->throwReferenceError(n);
 }
 
-ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Object *&base)
+ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Heap::Object **base)
 {
     Scope scope(this);
     ScopedValue v(scope);
-    base = (Object *)0;
+    *base = (Heap::Object *)0;
     name->makeIdentifier();
 
     if (name->equals(d()->engine->id_this))
@@ -424,7 +424,7 @@ ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Object *&base)
             bool hasProperty = false;
             v = w->get(name, &hasProperty);
             if (hasProperty) {
-                base = w;
+                *base = w->d();
                 return v.asReturnedValue();
             }
             continue;
@@ -454,7 +454,7 @@ ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Object *&base)
                 v = activation->get(name, &hasProperty);
                 if (hasProperty) {
                     if (ctx->d()->type == Heap::ExecutionContext::Type_QmlContext)
-                        base = activation;
+                        *base = activation->d();
                     return v.asReturnedValue();
                 }
             }
index 39456b2..7876c3a 100644 (file)
@@ -149,7 +149,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
 
     void setProperty(String *name, const ValueRef value);
     ReturnedValue getProperty(String *name);
-    ReturnedValue getPropertyAndBase(String *name, Object *&base);
+    ReturnedValue getPropertyAndBase(String *name, Heap::Object **base);
     bool deleteProperty(String *name);
 
     inline CallContext *asCallContext();
index c4c0fd4..9b8912f 100644 (file)
@@ -924,10 +924,8 @@ ReturnedValue Runtime::callActivationProperty(ExecutionEngine *engine, int nameI
     ScopedString name(scope, engine->currentContext()->compilationUnit->runtimeStrings[nameIndex]);
 
     ScopedObject base(scope);
-    Object *baseObj = 0;
     ScopedContext ctx(scope, engine->currentContext());
-    ScopedValue func(scope, ctx->getPropertyAndBase(name, baseObj));
-    base.ptr->m = baseObj ? &baseObj->data : 0;
+    ScopedValue func(scope, ctx->getPropertyAndBase(name, base.getRef()));
     if (scope.engine->hasException)
         return Encode::undefined();