CppKore: fix potential font resource leak

As of commit 168ad9aabd624510045d56aabcbfeff6f4aaad6f, we can assign uniform fonts to all child controls, but only 1 control can own the font resource. This is by default false since we do not want to free the resource when destroying the child controls, but we do want to free it once the parent window gets destroyed.
This commit is contained in:
Kawe Mazidjatari 2024-04-17 20:29:33 +02:00
parent d5db4674a4
commit 8e81d99585
2 changed files with 3 additions and 3 deletions

View File

@ -3,8 +3,8 @@
namespace Drawing
{
Font::Font(HWND Handle, const HFONT hFont)
: _Handle(Handle), _NativeFont(hFont), _OwnsFont(false)
Font::Font(HWND Handle, const HFONT hFont, const bool OwnsFont)
: _Handle(Handle), _NativeFont(hFont), _OwnsFont(OwnsFont)
{
}

View File

@ -10,7 +10,7 @@ namespace Drawing
{
public:
Font() = default;
Font(HWND Handle, const HFONT hFont);
Font(HWND Handle, const HFONT hFont, const bool OwnsFont = false);
Font(HWND Handle, const Gdiplus::Font& FontObject);
virtual ~Font();