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

orginal patch by 'Christoph at ApiViewer.de')
This commit is contained in:
Martin Fuchs 2005-10-03 11:03:04 +00:00 committed by Alexandre Julliard
parent 803146d220
commit c6593b04b9
1 changed files with 6 additions and 1 deletions

View File

@ -2246,9 +2246,11 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
if (ChooseFont(&chFont)) {
HWND childWnd;
HFONT hFontOld;
DeleteObject(Globals.hfont);
Globals.hfont = CreateFontIndirect(&lFont);
SelectFont(hdc, Globals.hfont);
hFontOld = SelectFont(hdc, Globals.hfont);
GetTextExtentPoint32(hdc, sSpace, 1, &Globals.spaceSize);
/* change font in all open child windows */
@ -2261,6 +2263,8 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
InvalidateRect(child->left.hwnd, NULL, TRUE);
InvalidateRect(child->right.hwnd, NULL, TRUE);
}
SelectFont(hdc, hFontOld);
}
else if (CommDlgExtendedError()) {
LoadString(Globals.hInstance, IDS_FONT_SEL_DLG_NAME, dlg_name, BUFFER_LEN);
@ -4756,6 +4760,7 @@ static void ExitInstance(void)
CoUninitialize();
#endif
DeleteObject(Globals.hfont);
ImageList_Destroy(Globals.himl);
}