winefile: fix font handle leak
Martin Fuchs
martin-fuchs at gmx.net
Sat Oct 1 03:24:51 CDT 2005
Changelog:
fix font handle leak after closing the 'choose font' dialog
(based on orginal patch by 'Christoph at ApiViewer.de')
Index: winefile.c
===================================================================
RCS file: /home/wine/wine/programs/winefile/winefile.c,v
retrieving revision 1.60
diff -u -p -d -r1.60 winefile.c
--- winefile.c 9 Sep 2005 15:20:04 -0000 1.60
+++ winefile.c 1 Oct 2005 08:26:33 -0000
@@ -2246,9 +2246,11 @@ static LRESULT CALLBACK FrameWndProc(HWN
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(HWN
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);
}
More information about the wine-patches
mailing list