mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Fix refreshTargets race condition
This commit is contained in:
parent
8f45045af0
commit
2c4361b830
1 changed files with 4 additions and 2 deletions
|
@ -645,7 +645,6 @@ class Runtime extends EventEmitter {
|
||||||
* inactive threads after each iteration.
|
* inactive threads after each iteration.
|
||||||
*/
|
*/
|
||||||
_step () {
|
_step () {
|
||||||
this._refreshTargets = false;
|
|
||||||
// Find all edge-activated hats, and add them to threads to be evaluated.
|
// Find all edge-activated hats, and add them to threads to be evaluated.
|
||||||
for (const hatType in this._hats) {
|
for (const hatType in this._hats) {
|
||||||
if (!this._hats.hasOwnProperty(hatType)) continue;
|
if (!this._hats.hasOwnProperty(hatType)) continue;
|
||||||
|
@ -663,7 +662,10 @@ class Runtime extends EventEmitter {
|
||||||
// @todo: Only render when this.redrawRequested or clones rendered.
|
// @todo: Only render when this.redrawRequested or clones rendered.
|
||||||
this.renderer.draw();
|
this.renderer.draw();
|
||||||
}
|
}
|
||||||
if (this._refreshTargets) this.emit(Runtime.TARGETS_UPDATE);
|
if (this._refreshTargets) {
|
||||||
|
this.emit(Runtime.TARGETS_UPDATE);
|
||||||
|
this._refreshTargets = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue