Skip to content

Commit

Permalink
fix(stackbar): destroy hpen, hbrush + hfont objs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
LGUG2Z committed May 29, 2024
1 parent 3232d92 commit 6c90001
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions komorebi/src/stackbar_manager/stackbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -235,6 +236,9 @@ impl Stackbar {
}

ReleaseDC(self.hwnd(), hdc);
DeleteObject(hpen);
DeleteObject(hbrush);
DeleteObject(hfont);
}

Ok(())
Expand Down

0 comments on commit 6c90001

Please sign in to comment.