diff options
author | Lars Knoll <[email protected]> | 2013-09-19 16:05:25 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-09-22 01:06:20 +0200 |
commit | 47bf40dd49f90b52cc1b545b2be3035d48d6199e (patch) | |
tree | 9e671c23d610822ac354e4a1399e2c805cbea599 /src/qml/jsruntime/qv4engine.cpp | |
parent | 78b49cf8361b1462cc94a061916a15f0b98e27e3 (diff) |
Prevent objects from being collected while in their constructor
While objects are being constructed, we don't have a reference to them
on the JS stack yet. So the constructor needs to protect itself against
being collected by putting the this object onto the JS stack.
Added an environment switch MM_EXACT_GC to test exact garbage
collection.
Change-Id: Ie37665a954de800359c272ffbebbe1488e7a8ace
Reviewed-by: Gunnar Sletta <[email protected]>
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 8d85ffd4fc..821e88ee61 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -358,7 +358,7 @@ ExecutionContext *ExecutionEngine::pushGlobalContext() Returned<FunctionObject> *ExecutionEngine::newBuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(SimpleCallContext *)) { - BuiltinFunction *f = new (memoryManager) BuiltinFunction(scope, name.getPointer(), code); + BuiltinFunction *f = new (memoryManager) BuiltinFunction(scope, name, code); return f->asReturned<FunctionObject>(); } |