feat(borders): clean up render targets on destroy

This commit is contained in:
LGUG2Z
2024-11-03 15:21:32 -08:00
parent 47cb19e54a
commit 3857d1a46c
2 changed files with 3 additions and 3 deletions

View File

@@ -15,7 +15,6 @@ use std::ops::Deref;
use std::sync::atomic::Ordering;
use std::sync::mpsc;
use std::sync::LazyLock;
use std::time::Duration;
use windows::Foundation::Numerics::Matrix3x2;
use windows::Win32::Foundation::BOOL;
use windows::Win32::Foundation::FALSE;
@@ -141,8 +140,6 @@ impl Border {
let _ = TranslateMessage(&msg);
DispatchMessageW(&msg);
}
std::thread::sleep(Duration::from_millis(1))
}
Ok(())
@@ -201,6 +198,8 @@ impl Border {
}
pub fn destroy(&self) -> color_eyre::Result<()> {
let mut render_targets = RENDER_TARGETS.lock();
render_targets.remove(&self.hwnd);
WindowsApi::close_window(self.hwnd)
}

View File

@@ -100,6 +100,7 @@ pub fn destroy_all_borders() -> color_eyre::Result<()> {
borders.clear();
BORDERS_MONITORS.lock().clear();
FOCUS_STATE.lock().clear();
RENDER_TARGETS.lock().clear();
let mut remaining_hwnds = vec![];