Module: wine Branch: master Commit: 2859e7d143d40a5cec330cd6c5b37b919a04a9bc URL: https://source.winehq.org/git/wine.git/?a=commit;h=2859e7d143d40a5cec330cd6c...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Jan 21 19:51:36 2018 +0300
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
---
dlls/comctl32/updown.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index 4f44b90..67b646d 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -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);