fix(audio): stop sound when dropped

This commit is contained in:
Nova
2024-09-12 15:32:56 -04:00
parent fec41dc1a1
commit 7f78f6f1a8

View File

@@ -85,6 +85,9 @@ impl SoundAspect for Sound {
}
impl Drop for Sound {
fn drop(&mut self) {
if let Some(instance) = self.instance.lock().take() {
instance.stop();
}
if let Some(sk_sound) = self.sk_sound.take() {
destroy_queue::add(sk_sound);
}