Commit c6593b04 authored by Martin Fuchs's avatar Martin Fuchs Committed by Alexandre Julliard

Fix font handle leak after closing the 'choose font' dialog (based on

orginal patch by 'Christoph at ApiViewer.de')
parent 803146d2
...@@ -2246,9 +2246,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM ...@@ -2246,9 +2246,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
if (ChooseFont(&chFont)) { if (ChooseFont(&chFont)) {
HWND childWnd; HWND childWnd;
HFONT hFontOld;
DeleteObject(Globals.hfont);
Globals.hfont = CreateFontIndirect(&lFont); Globals.hfont = CreateFontIndirect(&lFont);
SelectFont(hdc, Globals.hfont); hFontOld = SelectFont(hdc, Globals.hfont);
GetTextExtentPoint32(hdc, sSpace, 1, &Globals.spaceSize); GetTextExtentPoint32(hdc, sSpace, 1, &Globals.spaceSize);
/* change font in all open child windows */ /* change font in all open child windows */
...@@ -2261,6 +2263,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM ...@@ -2261,6 +2263,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
InvalidateRect(child->left.hwnd, NULL, TRUE); InvalidateRect(child->left.hwnd, NULL, TRUE);
InvalidateRect(child->right.hwnd, NULL, TRUE); InvalidateRect(child->right.hwnd, NULL, TRUE);
} }
SelectFont(hdc, hFontOld);
} }
else if (CommDlgExtendedError()) { else if (CommDlgExtendedError()) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN); LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN);
...@@ -4756,6 +4760,7 @@ static void ExitInstance(void) ...@@ -4756,6 +4760,7 @@ static void ExitInstance(void)
CoUninitialize(); CoUninitialize();
#endif #endif
DeleteObject(Globals.hfont);
ImageList_Destroy(Globals.himl); ImageList_Destroy(Globals.himl);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment