patch applied from Christoph at ApiViewer.de: fix font handle leak

svn path=/trunk/; revision=18174
This commit is contained in:
Martin Fuchs 2005-09-30 19:42:45 +00:00
parent 2357be7820
commit c9d6d045e6

View file

@ -2247,9 +2247,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 */
@ -2262,6 +2264,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);
@ -4774,6 +4778,7 @@ static void ExitInstance(void)
CoUninitialize();
#endif
DeleteObject(Globals.hfont);
ImageList_Destroy(Globals.himl);
}