From 4f2cccf279dba389cf6caf4239885f8a1b47ec8f Mon Sep 17 00:00:00 2001 From: Tim Mickel Date: Tue, 23 Aug 2016 18:37:03 -0400 Subject: [PATCH] Fix issue when broadcasting in a when-broadcast --- src/blocks/scratch3_event.js | 3 ++- src/engine/runtime.js | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blocks/scratch3_event.js b/src/blocks/scratch3_event.js index 60792345..b47ba014 100644 --- a/src/blocks/scratch3_event.js +++ b/src/blocks/scratch3_event.js @@ -76,7 +76,8 @@ Scratch3EventBlocks.prototype.broadcastAndWait = function (args, util) { var waiting = false; for (var i = 0; i < util.stackFrame.triggeredThreads.length; i++) { var thread = util.stackFrame.triggeredThreads[i]; - if (thread.status !== Thread.STATUS_DONE) { + var activeThreads = this.runtime.threads; + if (activeThreads.indexOf(thread) > -1) { // @todo: A cleaner way? waiting = true; } } diff --git a/src/engine/runtime.js b/src/engine/runtime.js index 62a08321..1d591c7a 100644 --- a/src/engine/runtime.js +++ b/src/engine/runtime.js @@ -204,7 +204,6 @@ Runtime.prototype._pushThread = function (id) { * @param {?Thread} thread Thread object to remove from actives */ Runtime.prototype._removeThread = function (thread) { - thread.setStatus(Thread.STATUS_DONE); var i = this.threads.indexOf(thread); if (i > -1) { this.glowScript(thread.topBlock, false);