From: Dan Bassi Subject: comctl32: Use strcmpW instead of pointer comparison to ensure treeview updates correctly Message-Id: Date: Sun, 19 Oct 2014 15:44:27 +0100

From a25444a83c81f96575ea718181720625ed2ea881 Mon Sep 17 00:00:00 2001 From: Dan Bassi Date: Sun, 19 Oct 2014 12:58:16 +0100 Subject: comctl32: Use strcmpW instead of pointer comparison to ensure treeview updates correctly --- dlls/comctl32/treeview.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 4067323..9e2d173 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -254,8 +254,12 @@ static inline BOOL item_changed (const TREEVIEW_ITEM *tiOld, const TREEVIEW_ITEM tiNew->iExpandedImage != I_IMAGECALLBACK) return TRUE; + /* Old text is a null pointer due to HeapAlloc() failing, therefore unable to perform strcmpW so assume text has changed */ + if (!tiOld->pszText) + return TRUE; + /* Text has changed and it's not a callback */ - if ((tvChange->mask & TVIF_TEXT) && (tiOld->pszText != tiNew->pszText) && + if ((tvChange->mask & TVIF_TEXT) && (strcmpW(tiOld->pszText, tiNew->pszText) != 0) && tiNew->pszText != LPSTR_TEXTCALLBACKW) return TRUE; @@ -2169,6 +2173,8 @@ TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, const TVITEMEXW *tvItem, BOOL isW) /* store the original item values */ originalItem = *item; + originalItem.pszText = HeapAlloc(GetProcessHeap(), 0, originalItem.cchTextMax * sizeof(WCHAR)); + if (originalItem.pszText) memcpy(originalItem.pszText, item->pszText, item->cchTextMax * sizeof(WCHAR)); if (!TREEVIEW_DoSetItemT(infoPtr, item, tvItem, isW)) return FALSE; @@ -2205,6 +2211,7 @@ TREEVIEW_SetItemT(TREEVIEW_INFO *infoPtr, const TVITEMEXW *tvItem, BOOL isW) } } + if (originalItem.pszText) HeapFree(GetProcessHeap(), 0, originalItem.pszText); return TRUE; } -- 1.9.1