comctl32/updown: Remove window subclass right before window is destroyed.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-01-21 19:51:36 +03:00 committed by Alexandre Julliard
parent 8aac7a224d
commit 2859e7d143
1 changed files with 21 additions and 12 deletions

View File

@ -592,14 +592,22 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
switch(uMsg)
{
case WM_KEYDOWN:
UPDOWN_KeyPressed(infoPtr, (int)wParam);
if ((wParam == VK_UP) || (wParam == VK_DOWN)) return 0;
break;
if (infoPtr)
{
UPDOWN_KeyPressed(infoPtr, (int)wParam);
if (wParam == VK_UP || wParam == VK_DOWN)
return 0;
}
break;
case WM_MOUSEWHEEL:
UPDOWN_MouseWheel(infoPtr, (int)wParam);
break;
if (infoPtr)
UPDOWN_MouseWheel(infoPtr, (int)wParam);
break;
case WM_NCDESTROY:
RemoveWindowSubclass(hwnd, UPDOWN_Buddy_SubclassProc, BUDDY_SUBCLASSID);
break;
default:
break;
}
@ -607,6 +615,11 @@ UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
static void UPDOWN_ResetSubclass (UPDOWN_INFO *infoPtr)
{
SetWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc, BUDDY_SUBCLASSID, 0);
}
/***********************************************************************
* UPDOWN_SetBuddy
*
@ -628,9 +641,8 @@ static HWND UPDOWN_SetBuddy (UPDOWN_INFO* infoPtr, HWND bud)
old_buddy = infoPtr->Buddy;
/* there is already a buddy assigned */
if (infoPtr->Buddy) RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
BUDDY_SUBCLASSID);
UPDOWN_ResetSubclass (infoPtr);
if (!IsWindow(bud)) bud = NULL;
/* Store buddy window handle */
@ -942,10 +954,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
case WM_DESTROY:
Free (infoPtr->AccelVect);
if (infoPtr->Buddy)
RemoveWindowSubclass(infoPtr->Buddy, UPDOWN_Buddy_SubclassProc,
BUDDY_SUBCLASSID);
UPDOWN_ResetSubclass (infoPtr);
Free (infoPtr);
SetWindowLongPtrW (hwnd, 0, 0);
theme = GetWindowTheme (hwnd);