comctl32: fix callback in treeview (try 3)

André Hentschel nerv at dawncrow.de
Mon Jan 19 14:20:13 CST 2009


undocumented: Some Apps sends NULL for tvItem->pszText. That should mean LPSTR_TEXTCALLBACKW.
Without this it runs in a Unhandled page fault on read access to 0x00000000.
(testcase following by Mikołaj Zalewski)
---
 dlls/comctl32/treeview.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index dd0563a..1b5162c 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -1112,7 +1112,7 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem,
     if (tvItem->mask & TVIF_TEXT)
     {
         wineItem->textWidth = 0; /* force width recalculation */
-	if (tvItem->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
+	if (tvItem->pszText != LPSTR_TEXTCALLBACKW && tvItem->pszText != 0) /* covers != TEXTCALLBACKA too, undocumented: NULL also means CALLBACK (see tests) */
 	{
             int len;
             LPWSTR newText;
-- 
1.6.0.4


--------------020107080606070502020005--



More information about the wine-patches mailing list