Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Peek] Fix memory leak caused by unmanaged bitmaps not being freed #34484

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/modules/peek/Peek.FilePreviewer/FilePreview.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ private async Task OnItemPropertyChanged()
_cancellationTokenSource.Cancel();
_cancellationTokenSource = new();

// Clear up any unmanaged resources before creating a new previewer instance.
(Previewer as IDisposable)?.Dispose();

if (Item == null)
{
Previewer = null;
Expand Down
6 changes: 0 additions & 6 deletions src/modules/peek/Peek.FilePreviewer/Peek.FilePreviewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@
</Page>
</ItemGroup>

<ItemGroup>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like unrelated changes here. Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was me removing a duplicate entry I found in the project file, and it's not related to the memory leak issue. I can split it out into a separate PR if you'd prefer.

<Page Update="Controls\UnsupportedFilePreview\FailedFallbackPreviewControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>

<ItemGroup>
<Page Update="FilePreview.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down
Loading