mkxp-z / mkxp-z

Open-source cross-platform player for (some) RPG Maker XP / VX / VX Ace games. A very heavily modified fork of mkxp. RGSS on steroids with a stupid name.
https://github.com/mkxp-z/mkxp-z/wiki
GNU General Public License v2.0
140 stars 39 forks source link

Fix a segfault in audio streams #192

Open WaywardHeart opened 3 weeks ago

WaywardHeart commented 3 weeks ago

We're currently closing audio streams as soon as the game attempts to open a new one. In the event that this fails, and then the next audio opened is the same as last successful attempt, we segfault. RGSS doesn't close the stream unless the attempt was successful, so I'm fixing the crash by doing that as well. Incidentally, I didn't actually see a game do that, I was just screwing around with something that ended up triggering it.

While I was poking around in the code I also saw that file handles for midi files were only closed if it errored, so that's fixed, too.