aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-12-19 12:39:21 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-19 15:06:56 +0100
commit7aa90e7123d05bd47340977d7282821eb56fa058 (patch)
treee2742c85c52331388c40930c9fa6011fa2091586 /src
parentd2f4be34c7d3a3cde549429615b07deb2335d21d (diff)
Fix GC crash with conditional breakpoints and JS console
We may choose to execute an expression in a specific frame within the debugger, which is where we pop context's until we reached the frame in question. If we are trying to execute an expression at the top of the stack (or with a conditional breakpoint expression), then we don't have a frame and don't need to pop contexts. But also also don't need to call Scope::alloc(-1). Change-Id: I1f6754a3d77d943aed9bf4468e817a5269a3c547 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index a835d835fb..50142ab155 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -65,10 +65,12 @@ public:
ExecutionContextSaver saver(engine->currentContext());
- Value *savedContexts = scope.alloc(frameNr);
- for (int i = 0; i < frameNr; ++i) {
- savedContexts[i] = engine->currentContext();
- engine->popContext();
+ if (frameNr > 0) {
+ Value *savedContexts = scope.alloc(frameNr);
+ for (int i = 0; i < frameNr; ++i) {
+ savedContexts[i] = engine->currentContext();
+ engine->popContext();
+ }
}
ExecutionContext *ctx = engine->currentContext();