huangfanglong

#52424: fix: Electron creates temporary icon files and does not delete them after use

Merged
Created: Jul 22, 2026, 4:19:33 PM
Merged: Jul 27, 2026, 6:40:08 PM
11 comments
Target: main

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

Release Notes

Notes: Fixed an issue where loading ICO files from ASAR archives on Windows left temporary icon files behind.

Backports

42-x-y
In-flight
PR Number
#52479
Waiting to be merged
43-x-y
Merged
PR Number
#52478
Merged At
Jul 27, 2026, 9:54:51 PM
Released In
Not yet
Release Date
Not yet
44-x-y
Merged
PR Number
#52477
Merged At
Jul 27, 2026, 10:17:13 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

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