From 6c90001c002ca643afd8d3ecb93db2915e3533f5 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Tue, 28 May 2024 17:41:17 -0700 Subject: [PATCH] fix(stackbar): destroy hpen, hbrush + hfont objs This commit ensures that HPEN, HBRUSH and HFONT objects which are used to draw stackbar tabs are explicitly destroyed with calls to DeleteObject after ReleaseDC has been called. re #855 --- komorebi/src/stackbar_manager/stackbar.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/komorebi/src/stackbar_manager/stackbar.rs b/komorebi/src/stackbar_manager/stackbar.rs index a6c5621b..f7f0084c 100644 --- a/komorebi/src/stackbar_manager/stackbar.rs +++ b/komorebi/src/stackbar_manager/stackbar.rs @@ -27,6 +27,7 @@ use windows::Win32::Foundation::WPARAM; use windows::Win32::Graphics::Gdi::CreateFontIndirectW; use windows::Win32::Graphics::Gdi::CreatePen; use windows::Win32::Graphics::Gdi::CreateSolidBrush; +use windows::Win32::Graphics::Gdi::DeleteObject; use windows::Win32::Graphics::Gdi::DrawTextW; use windows::Win32::Graphics::Gdi::GetDC; use windows::Win32::Graphics::Gdi::Rectangle; @@ -235,6 +236,9 @@ impl Stackbar { } ReleaseDC(self.hwnd(), hdc); + DeleteObject(hpen); + DeleteObject(hbrush); + DeleteObject(hfont); } Ok(())