#52424: fix: Electron creates temporary icon files and does not delete them after use
Description of Change
Fixes #52354
Previously, every ASAR ICO used Archive::CopyFileOut(). For packed files, that function stores the extracted file in Archive::external_files_. Since Electron caches ASAR archives globally, those temporary files remain alive and are never removed normally.
On Windows, Electron temporarily extract an ICO stored inside an ASAR archive before passing it to LoadImage. The previous implementation cached that extracted file for the lifetime of the process, which left *.tmp.ico files behind.
This change writes packed ICO data to a scoped temporary directory instead. The directory is removed immediately after Windows creates the in-memory HICON. ICO files marked as unpacked continue to load directly from app.asar.unpacked.
Checklist
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
Release Notes
Notes: Fixed an issue where loading ICO files from ASAR archives on Windows left temporary icon files behind.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron