Never delete the font object received by WM_SETFONT.
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index d0b0626..508a592 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -120,6 +120,7 @@
DWORD dwExtStyle;
INT selected; /* index of selected item */
DWORD flags; /* WINE internal flags */
+ HFONT hDefaultFont;
HFONT font;
INT nb_items; /* Number of items */
BOOL bUnicode; /* TRUE if this window is Unicode */
@@ -1209,7 +1210,7 @@
if (!infoPtr->font) {
SystemParametersInfoA (SPI_GETICONTITLELOGFONT, sizeof(mylogfont),
&mylogfont, 0);
- infoPtr->font = CreateFontIndirectA (&mylogfont);
+ infoPtr->font = infoPtr->hDefaultFont = CreateFontIndirectA (&mylogfont);
}
SendMessageW (infoPtr->hwndCombo, WM_SETFONT, (WPARAM)infoPtr->font, 0);
if (infoPtr->hwndEdit) {
@@ -1750,7 +1751,7 @@
}
}
- DeleteObject (infoPtr->font);
+ if (infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
/* free comboex info data */
COMCTL32_Free (infoPtr);
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 388fb73..545b8a1 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -200,6 +200,7 @@
HWND hwndSelf; /* handle of REBAR window itself */
HWND hwndToolTip; /* handle to the tool tip control */
HWND hwndNotify; /* notification window (parent) */
+ HFONT hDefaultFont;
HFONT hFont; /* handle to the rebar's font */
SIZE imageSize; /* image size (image list) */
DWORD dwStyle; /* window style */
@@ -3624,7 +3625,7 @@
DeleteObject (infoPtr->hcurHorz);
DeleteObject (infoPtr->hcurVert);
DeleteObject (infoPtr->hcurDrag);
- DeleteObject (infoPtr->hFont);
+ if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont);
SetWindowLongA (infoPtr->hwndSelf, 0, 0);
/* free rebar info data */
@@ -3834,7 +3835,7 @@
}
tfont = CreateFontIndirectA (&ncm.lfCaptionFont);
if (tfont) {
- infoPtr->hFont = tfont;
+ infoPtr->hFont = infoPtr->hDefaultFont = tfont;
}
/* native does:
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index b71158b..984c679 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -95,6 +95,7 @@
INT nButtonDown;
INT nOldHit;
INT nHotItem; /* index of the "hot" item */
+ HFONT hDefaultFont;
HFONT hFont; /* text font */
HIMAGELIST himlInt; /* image list created internally */
HIMAGELIST himlDef; /* default image list */
@@ -4048,7 +4049,7 @@
infoPtr->hwndSelf = hwnd;
SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
- infoPtr->hFont = CreateFontIndirectA (&logFont);
+ infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont);
if (dwStyle & TBSTYLE_TOOLTIPS) {
/* Create tooltip control */
@@ -4106,7 +4107,7 @@
/* delete default font */
if (infoPtr->hFont)
- DeleteObject (infoPtr->hFont);
+ DeleteObject (infoPtr->hDefaultFont);
/* free toolbar info data */
COMCTL32_Free (infoPtr);