From 3e64a227e5392ec5752ab7f0471d7c054da742c1 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 9 Oct 2021 21:48:43 +0200 Subject: [PATCH 1/2] Fix Object Selection not freeing the object when unhovering Fixes a double-free on previews. --- src/openrct2-ui/windows/EditorObjectSelection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 14222f5dc3..81957c73f9 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -757,7 +757,10 @@ static void window_editor_object_selection_scroll_mouseover( w->selected_list_item = selectedObject; if (_loadedObject != nullptr) + { _loadedObject->Unload(); + _loadedObject = nullptr; + } if (selectedObject == -1) { From daef940bc8a42adb621c870a2e6997b38e3ac67e Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 9 Oct 2021 21:49:40 +0200 Subject: [PATCH 2/2] Fix LargeSceneryObject and WaterObject not tearing down the image ID --- distribution/changelog.txt | 1 + src/openrct2/object/LargeSceneryObject.cpp | 2 +- src/openrct2/object/WaterObject.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 744d2249c1..dbfb60cc17 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -25,6 +25,7 @@ - Fix: [#15197] Cannot place flat ride after removing it in construction window. - Fix: [#15199] Construction window is not closed when a ride gets demolished. - Fix: [#15213] Freeze when hovering over Reverse Freefall Coaster in Russian. +- Fix: [#15227] Crash on exit after hovering over water types in the Object Selection window. - Fix: [#15255] Tile Inspector shows banner information on walls that do not contain one. - Fix: [#15257] Chat icon shows in scenario/track editor. Other icons don't disable when deactivated in options menu. - Fix: [#15289] Unexpected behavior with duplicated banners which also caused desyncs in multiplayer. diff --git a/src/openrct2/object/LargeSceneryObject.cpp b/src/openrct2/object/LargeSceneryObject.cpp index fa96ac5535..1ca0146744 100644 --- a/src/openrct2/object/LargeSceneryObject.cpp +++ b/src/openrct2/object/LargeSceneryObject.cpp @@ -98,7 +98,7 @@ void LargeSceneryObject::Unload() gfx_object_free_images(_baseImageId, GetImageTable().GetCount()); _legacyType.name = 0; - _legacyType.image = 0; + _baseImageId = _legacyType.image = 0; } void LargeSceneryObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const diff --git a/src/openrct2/object/WaterObject.cpp b/src/openrct2/object/WaterObject.cpp index 0ea6ff11a8..3fd438619e 100644 --- a/src/openrct2/object/WaterObject.cpp +++ b/src/openrct2/object/WaterObject.cpp @@ -46,6 +46,7 @@ void WaterObject::Unload() language_free_object_string(_legacyType.string_idx); _legacyType.string_idx = 0; + _legacyType.image_id = 0; } void WaterObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const