mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-20 10:19:35 -04:00
Fix the next thread is skipped after clone deleted
Problem: When a clone is deleted, its thread is removed from the thread list; but the index "i" in the execution for-loop will still +1, making the next thread skipped. Changes: Added a flag "isKilled" on a thread; Set the flag when a thread is removed from the thread list; reduce the "i" counter if the thread of the current loop is removed.
This commit is contained in:
parent
312e15932e
commit
6ec231db9d
3 changed files with 10 additions and 0 deletions
src/engine
|
@ -69,6 +69,9 @@ class Sequencer {
|
|||
// Normal-mode thread: step.
|
||||
this.stepThread(activeThread);
|
||||
activeThread.warpTimer = null;
|
||||
if (activeThread.isKilled) {
|
||||
i--; // if the thread is removed from the list (killed), do not increase index
|
||||
}
|
||||
}
|
||||
if (activeThread.status === Thread.STATUS_RUNNING) {
|
||||
numActiveThreads++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue