Skip to content

Commit

Permalink
fix: cleanup old icons correctly.
Browse files Browse the repository at this point in the history
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 electron#27.
  • Loading branch information
chuckrector committed Jan 18, 2022
1 parent b807b34 commit 072d463
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rescle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ BOOL CALLBACK ResourceUpdater::OnEnumResourceLanguage(HANDLE hModule, LPCWSTR lp
}
case reinterpret_cast<ptrdiff_t>(RT_ICON): {
UINT iconId = reinterpret_cast<ptrdiff_t>(lpszName);
UINT maxIconId = instance->iconBundleMap_[wIDLanguage].maxIconId;
UINT& maxIconId = instance->iconBundleMap_[wIDLanguage].maxIconId;
if (iconId > maxIconId)
maxIconId = iconId;
break;
Expand Down

0 comments on commit 072d463

Please sign in to comment.