From 27b475f8c136175c789b9f111967404854afa941 Mon Sep 17 00:00:00 2001 From: Amber Sienna Date: Thu, 4 Jun 2020 20:43:13 +0100 Subject: [PATCH 1/2] Fixed the crash, from my testing --- CalamityModMusic.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CalamityModMusic.cs b/CalamityModMusic.cs index 1dde5fb..1cf5de0 100644 --- a/CalamityModMusic.cs +++ b/CalamityModMusic.cs @@ -138,7 +138,9 @@ namespace CalamityModMusic public override void Unload() { + IL.Terraria.Main.UpdateAudio -= TitleMusicIL; customTitleMusicSlot = MusicID.Title; + Close(); titleMusicStopped?.Set(); Instance = null; titleMusicStopped = null; @@ -345,12 +347,11 @@ namespace CalamityModMusic public override void Close() { - // Close isn't called on the main thread. Who doesn't love a bit of thread safety - // Close may be called even if we didn't reach PostSetupContent, so don't try and stop a music track which hasn't been loaded or played - if (!Main.dedServ && customTitleMusicSlot > 0) + var slot = GetSoundSlot(SoundType.Music, "Sounds/Music/Calamity"); + + if (Main.music.IndexInRange(slot) && Main.music[slot]?.IsPlaying == true) { - stopTitleMusic = true; - titleMusicStopped.WaitOne(); + Main.music[slot].Stop(AudioStopOptions.Immediate); } base.Close(); } From f6103d8fe9b70c0ae77a39c42ccd157d7a6f0e51 Mon Sep 17 00:00:00 2001 From: Amber Sienna Date: Thu, 4 Jun 2020 20:45:41 +0100 Subject: [PATCH 2/2] version bump oops --- build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.txt b/build.txt index 2bf0deb..f552c8d 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 1.4.4.004 +version = 1.4.4.005 displayName = Calamity Mod Music homepage = https://forums.terraria.org/index.php?threads/calamity-mod.44065/ hideCode = true