From d597083c012274d9a591e0805e2d892393cc9e89 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 12 Dec 2012 18:35:42 +0100 Subject: [PATCH] Use a new and empty cleanup list for try statements when entering a function The cleanup list is local to a function definition. Otherwise inner functions would create cleanup code for try statements in outer functions leading to crashes. Change-Id: I5d35893b0ea6b0692cda44d5b34b0bb3dfc93fdd Reviewed-by: Simon Hausmann --- qv4codegen.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qv4codegen.cpp b/qv4codegen.cpp index a16d8c4..a6c1f7f 100644 --- a/qv4codegen.cpp +++ b/qv4codegen.cpp @@ -1613,6 +1613,8 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast, { qSwap(_mode, mode); // enter function code. + TryCleanup *tryCleanup = 0; + enterEnvironment(ast); IR::Function *function = _module->newFunction(name); if (_debugger) @@ -1665,6 +1667,7 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast, qSwap(_exitBlock, exitBlock); qSwap(_throwBlock, throwBlock); qSwap(_returnAddress, returnAddress); + qSwap(_tryCleanup, tryCleanup); for (FormalParameterList *it = formals; it; it = it->next) { _function->RECEIVE(it->name.toString()); @@ -1694,6 +1697,7 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast, qSwap(_exitBlock, exitBlock); qSwap(_throwBlock, throwBlock); qSwap(_returnAddress, returnAddress); + qSwap(_tryCleanup, tryCleanup); leaveEnvironment(); -- 2.7.4