Skip to content

Commit

Permalink
Merge pull request #2557 from ericrosenbaum/broadcast-wait-var-change…
Browse files Browse the repository at this point in the history
…-fix

Prevent "broadcast and wait" being interrupted by a change to its input
  • Loading branch information
ericrosenbaum authored Sep 16, 2020
2 parents 7c65224 + f103094 commit 9329f93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/blocks/scratch3_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ class Scratch3EventBlocks {
}

broadcastAndWait (args, util) {
const broadcastVar = util.runtime.getTargetForStage().lookupBroadcastMsg(
args.BROADCAST_OPTION.id, args.BROADCAST_OPTION.name);
if (broadcastVar) {
const broadcastOption = broadcastVar.name;
if (!util.stackFrame.broadcastVar) {
util.stackFrame.broadcastVar = util.runtime.getTargetForStage().lookupBroadcastMsg(
args.BROADCAST_OPTION.id, args.BROADCAST_OPTION.name);
}
if (util.stackFrame.broadcastVar) {
const broadcastOption = util.stackFrame.broadcastVar.name;
// Have we run before, starting threads?
if (!util.stackFrame.startedThreads) {
// No - start hats for this broadcast.
Expand Down
Binary file not shown.

0 comments on commit 9329f93

Please sign in to comment.