Skip to content

Commit

Permalink
fix the biggest gdiobject (font) leak
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Oct 19, 2023
1 parent a36ed26 commit 7ce826e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1861,6 +1861,7 @@ void FreeAllMenuDrawInfos() {
// Note: could be faster
FreeMenuOwnerDrawInfo(g_menuDrawInfos[0]);
}
DeleteMenuFont();
}

void FreeMenuOwnerDrawInfo(MenuOwnerDrawInfo* modi) {
Expand All @@ -1881,6 +1882,10 @@ HFONT GetMenuFont() {
return gMenuFont;
}

void DeleteMenuFont() {
DeleteFontSafe(&gMenuFont);
}

struct MenuText {
WCHAR* menuText;
int menuTextLen;
Expand Down
4 changes: 4 additions & 0 deletions src/Notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,12 @@ int GetWndX(NotificationWnd* wnd) {
}

NotificationWnd::~NotificationWnd() {
auto fontToDelete = font;
Destroy();
str::Free(progressMsg);
if (fontToDelete) {
DeleteObject(fontToDelete);
}
}

HWND NotificationWnd::Create(NotificationCreateArgs& args) {
Expand Down

0 comments on commit 7ce826e

Please sign in to comment.