[Peek] Previewer icon bitmaps are never deleted, leaking memory #34527
Labels
Issue-Bug
Something isn't working
Product-Peek
Refers to Peek Powertoys
Status-In progress
This issue or work-item is under development
Microsoft PowerToys version
0.83.0
Installation method
PowerToys auto-update
Running as admin
No
Area(s) with issue?
Peek
Steps to reproduce
Use Peek to preview an audio file, a 'special folder' (e.g. one containing images where their thumbnails are shown on the folder itself), an unsupported file, or a drive. The icon subsequently displayed in the Peek UI is retrieved using the
IconHelper
in thePeek.FilePreviewer.Previewers.Helpers
namespace.In
IconHelper.GetImageAsync()
, the handle for the retrieved icon bitmap is set to IntPtr.Zero immediately after being retrieved, instead of being disposed of usingNativeMethods.DeleteObject
in the finally block. The handle's resource is never freed and remains in memory:I have a fix for this and other thumbnail-related issues. As they are interrelated, I would like to tackle them in a single PR.
✔️ Expected Behavior
After navigating to an item where an icon graphic is shown in the previewer, the unmanaged bitmap resource is correctly freed.
❌ Actual Behavior
The unmanaged bitmap memory for the icon is not freed, taking up process memory.
Other Software
No response
The text was updated successfully, but these errors were encountered: