Fix #17664: Ride music channel data leaks when stopping inactive music

This commit is contained in:
Silent 2022-10-03 20:02:27 +02:00 committed by GitHub
parent ad4c45bf38
commit 82088f3496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 15 deletions

View File

@ -58,6 +58,7 @@
- Fix: [#17600] Notifications are not properly cleared when loading a park.
- Fix: [#17605] Crash when opening parks which have had objects removed externally.
- Fix: [#17639, 17735] When building upside down, the special elements list contains many items twice (original bug).
- Fix: [#17664] Unable to save after an extended period of time due to inactive ride music data leaking.
- Fix: [#17703] (undefined string) when building on invalid height.
- Fix: [#17776] “Other Parks” tab uses separate lists for SC4/SC6 and .park scenarios.
- Fix: [#17784] Colour preset RNG is biased (original bug).

View File

@ -77,6 +77,8 @@ namespace OpenRCT2::RideAudio
RideMusicChannel& operator=(RideMusicChannel&& src) noexcept
{
using std::swap;
RideId = src.RideId;
TrackIndex = src.TrackIndex;
@ -85,15 +87,8 @@ namespace OpenRCT2::RideAudio
Pan = src.Pan;
Frequency = src.Frequency;
if (Channel != nullptr)
{
Channel->Stop();
}
Channel = src.Channel;
src.Channel = nullptr;
Source = src.Source;
src.Source = nullptr;
swap(Channel, src.Channel);
swap(Source, src.Source);
return *this;
}
@ -103,12 +98,10 @@ namespace OpenRCT2::RideAudio
if (Channel != nullptr)
{
Channel->Stop();
Channel = nullptr;
if (Source != nullptr)
{
Source->Release();
Source = nullptr;
}
}
if (Source != nullptr)
{
Source->Release();
}
}