Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/scratch-vm/src/engine/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,10 @@ class Runtime extends EventEmitter {
// threads are stepped. See ScratchRuntime.as for original implementation
newThreads.forEach(thread => {
execute(this.sequencer, thread);
if (thread.status === Thread.STATUS_DONE) {
// Thread might be done after `execute`.
return;
}
thread.goToNextBlock();
});
return newThreads;
Expand Down
2 changes: 1 addition & 1 deletion packages/scratch-vm/src/engine/sequencer.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Sequencer {
*/
retireThread (thread) {
thread.stack = [];
thread.stackFrame = [];
thread.stackFrames = [];
thread.requestScriptGlowInFrame = false;
thread.status = Thread.STATUS_DONE;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/scratch-vm/src/engine/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class Thread {
/**
* Reset the stack frame for use by the next block.
* (avoids popping and re-pushing a new stack frame - keeps the warpmode the same
* @param {string} blockId Block ID to push to stack.
* @param {string | null} blockId Block ID to push to stack.
*/
reuseStackForNextBlock (blockId) {
this.stack[this.stack.length - 1] = blockId;
Expand Down
Loading