From c9d6d045e602c6db4132e7c46b8f5d20513b9530 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Fri, 30 Sep 2005 19:42:45 +0000 Subject: [PATCH] patch applied from Christoph at ApiViewer.de: fix font handle leak svn path=/trunk/; revision=18174 --- reactos/subsys/system/winefile/winefile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reactos/subsys/system/winefile/winefile.c b/reactos/subsys/system/winefile/winefile.c index 48f3fe25461..f5cb83b6577 100644 --- a/reactos/subsys/system/winefile/winefile.c +++ b/reactos/subsys/system/winefile/winefile.c @@ -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); }