diff options
author | Ulf Hermann <[email protected]> | 2023-12-21 16:53:36 +0100 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2024-01-10 11:22:37 +0100 |
commit | be6d1499af75228341227d15441284e07cfe1e41 (patch) | |
tree | 99c5b1e3dc7f1b99d8c141f1b8138feacd29e020 /src/qml/jsruntime/qv4functionobject.cpp | |
parent | cfdc612c3022b3f35545fd5e4e0bcd2661f657f1 (diff) |
QtQml: Always link executable CU on creation
We don't want floating unlinked executable CUs. They should always be
tied to an engine, and the engine should not change. This gives us one
definite point where to register them with the engine (to be done in
subsequent change).
Unfortunately, due to the refcounting, we need to remove the engine from
any still-referenced CUs when the engine itself is destructed. We will
be able to drop the refcounting and make the engine fully own its
executable CUs once we can hold base CUs in most places.
Change-Id: I9a53e83d5c4746c2b2bca896b51baa4fe7fee757
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 0b11cdfe20..aff4a02115 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -256,7 +256,7 @@ QQmlRefPointer<ExecutableCompilationUnit> FunctionCtor::parse(ExecutionEngine *e if (engine->hasException) return nullptr; - return ExecutableCompilationUnit::create(cg.generateCompilationUnit()); + return ExecutableCompilationUnit::create(cg.generateCompilationUnit(), engine); } ReturnedValue FunctionCtor::virtualCallAsConstructor(const FunctionObject *f, const Value *argv, int argc, const Value *newTarget) @@ -268,7 +268,7 @@ ReturnedValue FunctionCtor::virtualCallAsConstructor(const FunctionObject *f, co if (engine->hasException) return Encode::undefined(); - Function *vmf = compilationUnit->linkToEngine(engine); + Function *vmf = compilationUnit->rootFunction(); ExecutionContext *global = engine->scriptContext(); ReturnedValue o = Encode(FunctionObject::createScriptFunction(global, vmf)); |