mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 15:13:12 -04:00
Fix WGPU implementation memory leak
Now unused surfaces will be cleared
This commit is contained in:
@@ -1909,6 +1909,7 @@ mod wgpu_integration {
|
||||
|
||||
windows.retain(|id, _| active_viewports_ids.contains(id));
|
||||
windows_id.retain(|_, id| active_viewports_ids.contains(id));
|
||||
painter.clean_surfaces(active_viewports_ids);
|
||||
|
||||
let mut control_flow = vec![EventResult::Wait];
|
||||
for repaint_after in repaint_after {
|
||||
|
||||
@@ -615,6 +615,11 @@ impl Painter {
|
||||
screenshot
|
||||
}
|
||||
|
||||
pub fn clean_surfaces(&mut self, avalibile_viewports: Vec<u64>) {
|
||||
self.surfaces
|
||||
.retain(|id, _| avalibile_viewports.contains(id))
|
||||
}
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
pub fn destroy(&mut self) {
|
||||
// TODO(emilk): something here?
|
||||
|
||||
Reference in New Issue
Block a user