Use Timer.Spawn instead of TimerComp timers when disposing MIDI Renderers.
- Fixes a bug where renderers are not disposed of correctly when the instrument entity is deleted.
This commit is contained in:
parent
4b6ca8fd93
commit
e9c812c29c
1 changed files with 2 additions and 1 deletions
|
|
@ -129,7 +129,8 @@ namespace Content.Client.Instruments
|
|||
var renderer = instrument.Renderer;
|
||||
|
||||
// We dispose of the synth two seconds from now to allow the last notes to stop from playing.
|
||||
instrument.Owner.SpawnTimer(2000, () => { renderer?.Dispose(); });
|
||||
// Don't use timers bound to the entity in case it is getting deleted.
|
||||
Timer.Spawn(2000, () => { renderer?.Dispose(); });
|
||||
instrument.Renderer = null;
|
||||
instrument.MidiEventBuffer.Clear();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue