Skip to content

Commit

Permalink
fix: cleanup old icons correctly.
Browse files Browse the repository at this point in the history
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 pull electron#54 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 ee3fc8d
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 ee3fc8d

Please sign in to comment.