comctl32/tooltips: 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 2017-12-20 01:21:44 +03:00 committed by Alexandre Julliard
parent 10aa228ccc
commit b68dbf4ea1
1 changed files with 22 additions and 19 deletions

View File

@ -1888,16 +1888,12 @@ TOOLTIPS_Destroy (TOOLTIPS_INFO *infoPtr)
} }
} }
/* remove subclassing */ /* Reset subclassing data. */
if (toolPtr->uInternalFlags & TTF_SUBCLASS) { if (toolPtr->uInternalFlags & TTF_SUBCLASS)
if (toolPtr->uInternalFlags & TTF_IDISHWND) { SetWindowSubclass(toolPtr->uInternalFlags & TTF_IDISHWND ? (HWND)toolPtr->uId : toolPtr->hwnd,
RemoveWindowSubclass((HWND)toolPtr->uId, TOOLTIPS_SubclassProc, 1); TOOLTIPS_SubclassProc, 1, 0);
}
else {
RemoveWindowSubclass(toolPtr->hwnd, TOOLTIPS_SubclassProc, 1);
}
} }
}
Free (infoPtr->tools); Free (infoPtr->tools);
} }
@ -2117,12 +2113,13 @@ TOOLTIPS_WinIniChange (TOOLTIPS_INFO *infoPtr)
static LRESULT CALLBACK static LRESULT CALLBACK
TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef) TOOLTIPS_SubclassProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR uID, DWORD_PTR dwRef)
{ {
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef); TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef);
MSG msg; MSG msg;
switch(uMsg) { switch (message)
{
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONUP: case WM_LBUTTONUP:
@ -2130,17 +2127,23 @@ TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_
case WM_MBUTTONUP: case WM_MBUTTONUP:
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
case WM_RBUTTONUP: case WM_RBUTTONUP:
msg.hwnd = hwnd; if (infoPtr)
msg.message = uMsg; {
msg.wParam = wParam; msg.hwnd = hwnd;
msg.lParam = lParam; msg.message = message;
TOOLTIPS_RelayEvent(infoPtr, &msg); msg.wParam = wParam;
break; msg.lParam = lParam;
TOOLTIPS_RelayEvent(infoPtr, &msg);
}
break;
case WM_NCDESTROY:
RemoveWindowSubclass(hwnd, TOOLTIPS_SubclassProc, 1);
break;
default: default:
break; break;
} }
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
return DefSubclassProc(hwnd, message, wParam, lParam);
} }