From 15bdbd89639c29f88db1798de66066a4a95759c0 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 5 Sep 2018 14:56:24 +0200 Subject: Fix exception handling while destructuring When an exception happens during destructuring, IteratorClose needs to be called, unless the exception happened inside the IteratorNext call (in that case the iterator is assumed to be invalid and we shouldn't call close on it). Implement this, by ensuring that we set the done return variable of IteratorNext to true whenever IteratorNext throws an exception. IteratorClose will check the done state and not do anything in that case. Change-Id: I73a27f855f2c4d3134b8cc8980e64bf797d03886 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4vme_moth.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qml/jsruntime/qv4vme_moth.cpp') diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 2d1f4c3e91..f38bd7b48e 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -875,6 +875,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine, MOTH_BEGIN_INSTR(IteratorNext) STORE_ACC(); acc = Runtime::method_iteratorNext(engine, accumulator, &STACK_VALUE(value)); + STACK_VALUE(done) = acc; CHECK_EXCEPTION; MOTH_END_INSTR(IteratorNext) -- cgit v1.2.3