From f2633df1be25acdf1a5444bbd301955ae3412297 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 10 Apr 2018 15:23:30 +0200 Subject: Fix leak of compiler contexts Repeatedly entering a context that was entered before would result in leaking the previously entered context. This can happen when compiling child objects in a QML file, which is done recursively. So before compiling the bindings/function in the child object, first the global context and then the QML context are entered. The fix is to re-use the global context, as it's the same anyway for all objects in the same module. And we can remove entering the QML context, because nothing is in there, and we don't put anything in it ever. Change-Id: Ib1c4259d2dec22df46e96edb65bc3d377e52e671 Reviewed-by: Simon Hausmann --- src/qml/compiler/qv4compilercontext.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qml/compiler/qv4compilercontext.cpp') diff --git a/src/qml/compiler/qv4compilercontext.cpp b/src/qml/compiler/qv4compilercontext.cpp index 3293dc53c8..0a9d3d8efe 100644 --- a/src/qml/compiler/qv4compilercontext.cpp +++ b/src/qml/compiler/qv4compilercontext.cpp @@ -49,6 +49,8 @@ QT_BEGIN_NAMESPACE Context *Module::newContext(Node *node, Context *parent, CompilationMode compilationMode) { + Q_ASSERT(!contextMap.contains(node)); + Context *c = new Context(parent, compilationMode); if (node) { SourceLocation loc = node->firstSourceLocation(); -- cgit v1.2.3