[PATCH] comctrl32/tooltips: AddTool doesn't fails on empty TTTOOLINFO structure
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Mon Apr 4 04:48:07 CDT 2016
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/comctl32/tests/tooltips.c | 21 +++++++++++++++++++++
dlls/comctl32/tooltips.c | 4 ++++
2 files changed, 25 insertions(+)
diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c
index 3382fce..2d1ccbb 100644
--- a/dlls/comctl32/tests/tooltips.c
+++ b/dlls/comctl32/tests/tooltips.c
@@ -360,6 +360,27 @@ static void test_gettext(void)
return;
}
+ /* Empty TTTOOLINFO */
+ memset(&toolinfoA, 0, sizeof(toolinfoA));
+ toolinfoA.cbSize = TTTOOLINFOA_V1_SIZE;
+ r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
+ ok(r, "Adding the tool to the tooltip failed\n");
+
+ memset(&toolinfoA, 0, sizeof(toolinfoA));
+ toolinfoA.cbSize = sizeof(TTTOOLINFOA);
+ r = SendMessageA(hwnd, TTM_ADDTOOLA, 0, (LPARAM)&toolinfoA);
+ ok(r, "Adding the tool to the tooltip failed\n");
+
+ memset(&toolinfoW, 0, sizeof(toolinfoW));
+ toolinfoW.cbSize = TTTOOLINFOW_V1_SIZE;
+ r = SendMessageA(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
+ ok(r, "Adding the tool to the tooltip failed\n");
+
+ memset(&toolinfoW, 0, sizeof(toolinfoW));
+ toolinfoW.cbSize = sizeof(TTTOOLINFOW);
+ r = SendMessageA(hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfoW);
+ ok(r, "Adding the tool to the tooltip failed\n");
+
/* add another tool with text */
toolinfoA.cbSize = sizeof(TTTOOLINFOA);
toolinfoA.hwnd = NULL;
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 8bf6919..c91d259 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -1038,6 +1038,10 @@ TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
infoPtr->hwndSelf, ti->hwnd, ti->uId,
(ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
+ if(!ti->uFlags && !ti->hwnd && !ti->uId && IsRectEmpty(&ti->rect) &&
+ !ti->hinst && !ti->lpszText && !ti->lParam)
+ return TRUE;
+
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE && !ti->lpszText && isW)
return FALSE;
--
1.9.1
More information about the wine-patches
mailing list