Skip to content

Commit 7ce826e

Browse files
committed
fix the biggest gdiobject (font) leak
1 parent a36ed26 commit 7ce826e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Menu.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1861,6 +1861,7 @@ void FreeAllMenuDrawInfos() {
18611861
// Note: could be faster
18621862
FreeMenuOwnerDrawInfo(g_menuDrawInfos[0]);
18631863
}
1864+
DeleteMenuFont();
18641865
}
18651866

18661867
void FreeMenuOwnerDrawInfo(MenuOwnerDrawInfo* modi) {
@@ -1881,6 +1882,10 @@ HFONT GetMenuFont() {
18811882
return gMenuFont;
18821883
}
18831884

1885+
void DeleteMenuFont() {
1886+
DeleteFontSafe(&gMenuFont);
1887+
}
1888+
18841889
struct MenuText {
18851890
WCHAR* menuText;
18861891
int menuTextLen;

src/Notifications.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,12 @@ int GetWndX(NotificationWnd* wnd) {
163163
}
164164

165165
NotificationWnd::~NotificationWnd() {
166+
auto fontToDelete = font;
166167
Destroy();
167168
str::Free(progressMsg);
169+
if (fontToDelete) {
170+
DeleteObject(fontToDelete);
171+
}
168172
}
169173

170174
HWND NotificationWnd::Create(NotificationCreateArgs& args) {

0 commit comments

Comments
 (0)