patch applied from Christoph at ApiViewer.de: fix font handle leak
Modified: trunk/reactos/subsys/system/winefile/winefile.c

Modified: trunk/reactos/subsys/system/winefile/winefile.c
--- trunk/reactos/subsys/system/winefile/winefile.c	2005-09-30 18:54:48 UTC (rev 18173)
+++ trunk/reactos/subsys/system/winefile/winefile.c	2005-09-30 19:42:45 UTC (rev 18174)
@@ -2247,9 +2247,11 @@
 
 					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 @@
 							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 @@
 	CoUninitialize();
 #endif
 
+	DeleteObject(Globals.hfont);
 	ImageList_Destroy(Globals.himl);
 }