From c812b696bdcc3f66ea9981c1aa66d7c620040f04 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 10 Oct 2021 15:01:18 -0600 Subject: [PATCH] Fix #14741: crash on macOS exit (#15550) --- distribution/changelog.txt | 1 + src/openrct2/paint/Painter.cpp | 9 +++++++++ src/openrct2/paint/Painter.h | 1 + 3 files changed, 11 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d1fb7b809e..181d9c1061 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -15,6 +15,7 @@ - Fix: [#14316] Closing the Track Designs Manager window causes broken state. - Fix: [#14649] ImageImporter incorrectly remaps colours outside the RCT2 palette. - Fix: [#14667] “Extreme Hawaiian Island” has unpurchaseable land tiles (original bug). +- Fix: [#14741] Crash when exiting OpenRCT2 on macOS. - Fix: [#15096] Crash when placing entrances in the scenario editor near the map corner. - Fix: [#15136] Exported SV6 files cause vanilla RCT2 to hang. - Fix: [#15142] ToonTowner's mine roofs were moved into the pirate theme scenery group instead of the mine theme scenery group. diff --git a/src/openrct2/paint/Painter.cpp b/src/openrct2/paint/Painter.cpp index 46ccdd559d..f831f9cb56 100644 --- a/src/openrct2/paint/Painter.cpp +++ b/src/openrct2/paint/Painter.cpp @@ -170,3 +170,12 @@ void Painter::ReleaseSession(paint_session* session) session->PaintEntryChain.Clear(); _freePaintSessions.push_back(session); } + +Painter::~Painter() +{ + for (auto&& session : _paintSessionPool) + { + ReleaseSession(session.get()); + } + _paintSessionPool.clear(); +} diff --git a/src/openrct2/paint/Painter.h b/src/openrct2/paint/Painter.h index d776f6f557..7bcc9ba2f0 100644 --- a/src/openrct2/paint/Painter.h +++ b/src/openrct2/paint/Painter.h @@ -49,6 +49,7 @@ namespace OpenRCT2 paint_session* CreateSession(rct_drawpixelinfo* dpi, uint32_t viewFlags); void ReleaseSession(paint_session* session); + ~Painter(); private: void PaintReplayNotice(rct_drawpixelinfo* dpi, const char* text);