Zhiyi Zhang : comctl32/ipaddress: Delete font when destroying the control.
Module: wine Branch: master Commit: 23c5d4c065d5b7cfa14f43d9136650ff4534652d URL: https://gitlab.winehq.org/wine/wine/-/commit/23c5d4c065d5b7cfa14f43d9136650f... Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Tue May 14 12:30:28 2024 +0800 comctl32/ipaddress: Delete font when destroying the control. For bug for bug compatibility, delete the font set by WM_SETFONT when destroying the control even if the font is not owned by the control according to tests. --- dlls/comctl32/ipaddress.c | 7 +++++++ dlls/comctl32/tests/misc.c | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c index 493ea77f618..be7e45def97 100644 --- a/dlls/comctl32/ipaddress.c +++ b/dlls/comctl32/ipaddress.c @@ -55,6 +55,7 @@ typedef struct HWND Self; HWND Notify; BOOL Enabled; + HFONT hFont; IPPART_INFO Part[4]; } IPADDRESS_INFO; @@ -269,6 +270,8 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr) SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)part->OrigProc); } + if (infoPtr->hFont) + DeleteObject (infoPtr->hFont); SetWindowLongPtrW (infoPtr->Self, 0, 0); theme = GetWindowTheme (infoPtr->Self); CloseThemeData (theme); @@ -651,6 +654,10 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) IPADDRESS_SetFocusToField (infoPtr, 0); break; + case WM_SETFONT: + infoPtr->hFont = (HFONT)wParam; + return 0; + default: if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x, wp %Ix, lp %Ix\n", uMsg, wParam, lParam); diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index 0ecf240ae4d..ff6336f31af 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -1239,14 +1239,9 @@ static void test_WM_SETFONT(void) ret = GetObjectA(hfont, sizeof(lf), &lf); if (!lstrcmpA(tests[i].class_name, WC_IPADDRESSA)) - { - todo_wine ok(ret == 0, "GetObjectA succeeded.\n"); - } else - { ok(ret == sizeof(lf), "GetObjectA failed, error %lu.\n", GetLastError()); - } winetest_pop_context(); }
participants (1)
-
Alexandre Julliard