From 072d46338e00d557d7d7a46e30eeaa2d4c10a450 Mon Sep 17 00:00:00 2001 From: Charles Rector Date: Mon, 17 Jan 2022 16:56:20 -0800 Subject: [PATCH] fix: cleanup old icons correctly. 0123456789012345678901234567890123456789012345678901234567890123456789 This updates the correct field rather than assigning the new max icon ID to a local variable. Previously, if you had set an icon with ten images and then later set a new icon with only one image, nine old images would linger in the executable. If you revised your icon over time and reduced the number of images each time, old icons from multiple different passes would linger in the executable. This bug was introduced by af37f5f which landed after the fix to a similar bug that was described in issue #27. --- src/rescle.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rescle.cc b/src/rescle.cc index 4cdff4a..5aa2f70 100644 --- a/src/rescle.cc +++ b/src/rescle.cc @@ -902,7 +902,7 @@ BOOL CALLBACK ResourceUpdater::OnEnumResourceLanguage(HANDLE hModule, LPCWSTR lp } case reinterpret_cast(RT_ICON): { UINT iconId = reinterpret_cast(lpszName); - UINT maxIconId = instance->iconBundleMap_[wIDLanguage].maxIconId; + UINT& maxIconId = instance->iconBundleMap_[wIDLanguage].maxIconId; if (iconId > maxIconId) maxIconId = iconId; break;