Strange Music Bug

So I've noticed from time to time the incorrect music plays when I load up a save. The music from one map will play over the music of another, even if I've never saved in there before.

I think it has something to do with a bit of code in Game_System, but I'm curious. Is there a way to fix it so the wrong music doesn't play?

(Also if this is the wrong place to ask this type of question please correct me)
The music after loading a slot depends on the slot's #bgm_on_save, which depends on RPG::BGM.last, which depends on being set by playing music through #play() of an RPG::BGM instance.

So my guess is that maybe somewhere Audio.bgm_play() is called. Doing so means the game doesn't store any data about it, so @@last will contain wrong/older filename and parameters.

Definition of RPG::BGM as written in the help of RPGVXAce:
1648723406238.png


Everything mentioned also applies to BGS.

~炬燵あ

Original thread: https://forums.rpgmakerweb.com/threads/strange-music-bug.146291/