Use image cache to stop leaking images (#29452)
This PR fixes several possible memory leaks due to loading images in markdown files and the image viewer, using the new image cache APIs TODO: - [x] Ensure this didn't break rendering in any of the affected components. Release Notes: - Fixed several image related memory leaks
This commit is contained in:
parent
d732a7d361
commit
4758173c33
12 changed files with 181 additions and 46 deletions
|
@ -26,8 +26,8 @@ use git_ui::project_diff::ProjectDiffToolbar;
|
|||
use gpui::{
|
||||
Action, App, AppContext as _, AsyncWindowContext, Context, DismissEvent, Element, Entity,
|
||||
Focusable, KeyBinding, ParentElement, PathPromptOptions, PromptLevel, ReadGlobal, SharedString,
|
||||
Styled, Task, TitlebarOptions, UpdateGlobal, Window, WindowKind, WindowOptions, actions, point,
|
||||
px,
|
||||
Styled, Task, TitlebarOptions, UpdateGlobal, Window, WindowKind, WindowOptions, actions,
|
||||
image_cache, point, px, retain_all,
|
||||
};
|
||||
use image_viewer::ImageInfo;
|
||||
use migrate::{MigrationBanner, MigrationEvent, MigrationNotification, MigrationType};
|
||||
|
@ -1336,7 +1336,7 @@ fn show_markdown_app_notification<F>(
|
|||
let primary_button_on_click = primary_button_on_click.clone();
|
||||
cx.new(move |cx| {
|
||||
MessageNotification::new_from_builder(cx, move |window, cx| {
|
||||
gpui::div()
|
||||
image_cache(retain_all("notification-cache"))
|
||||
.text_xs()
|
||||
.child(markdown_preview::markdown_renderer::render_parsed_markdown(
|
||||
&parsed_markdown.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue