Fix #15184: Crash when hovering over water types in Object Selection

This commit is contained in:
Michael Steenbeek 2021-08-11 17:51:20 +02:00 committed by GitHub
parent 1168425f14
commit 385c9ee5ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -12,6 +12,7 @@
- Fix: [#15142] ToonTowner's mine roofs were moved into the pirate theme scenery group instead of the mine theme scenery group.
- Fix: [#15148] Track Designs Manager delete confirmation window doesn't display properly.
- Fix: [#15170] Plugin: incorrect label text alignment.
- Fix: [#15184] Crash when hovering over water types in Object Selection.
- Improved: [#3417] Crash dumps are now placed in their own folder.
- Change: [#8601] Revert ToonTower base block fix to re-enable support blocking.
- Change: [#15174] [Plugin] Deprecate the type "peep" and add support to target a specific scripting api version.

View File

@ -30,7 +30,7 @@ static bool _initialised = false;
static std::list<ImageList> _freeLists;
static uint32_t _allocatedImageCount;
#ifdef DEBUG
#ifdef DEBUG_LEVEL_1
static std::list<ImageList> _allocatedLists;
// MSVC's compiler doesn't support the [[maybe_unused]] attribute for unused static functions. Until this has been resolved, we
@ -76,7 +76,7 @@ static void InitialiseImageList()
_freeLists.clear();
_freeLists.push_back({ BASE_IMAGE_ID, MAX_IMAGES });
#ifdef DEBUG
#ifdef DEBUG_LEVEL_1
_allocatedLists.clear();
#endif
_allocatedImageCount = 0;
@ -124,7 +124,7 @@ static uint32_t TryAllocateImageList(uint32_t count)
_freeLists.push_back(remainder);
}
#ifdef DEBUG
#ifdef DEBUG_LEVEL_1
_allocatedLists.push_back({ imageList.BaseId, count });
#endif
_allocatedImageCount += count;
@ -163,9 +163,11 @@ static void FreeImageList(uint32_t baseImageId, uint32_t count)
Guard::Assert(_initialised, GUARD_LINE);
Guard::Assert(baseImageId >= BASE_IMAGE_ID, GUARD_LINE);
#ifdef DEBUG
bool contains = AllocatedListRemove(baseImageId, count);
Guard::Assert(contains, GUARD_LINE);
#ifdef DEBUG_LEVEL_1
if (!AllocatedListRemove(baseImageId, count))
{
log_error("Cannot unload %u items from offset %u", count, baseImageId);
}
#endif
_allocatedImageCount -= count;
@ -234,7 +236,7 @@ void gfx_object_check_all_images_freed()
{
if (_allocatedImageCount != 0)
{
#ifdef DEBUG
#ifdef DEBUG_LEVEL_1
Guard::Assert(_allocatedImageCount == 0, "%u images were not freed", _allocatedImageCount);
#else
Console::Error::WriteLine("%u images were not freed", _allocatedImageCount);