Listview FindInfoA fix

Dimitrie O. Paun dimi at cs.toronto.edu
Sat Jan 26 00:59:21 CST 2002


ChangeLog
  Avoid converting nonexistent text from A->W.
  Found (and fixed) by Gerard Patel <gerard.patel at nerim.net>

--
Dimi.
-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v
retrieving revision 1.108
diff -u -r1.108 listview.c
--- dlls/comctl32/listview.c	18 Jan 2002 19:05:35 -0000	1.108
+++ dlls/comctl32/listview.c	26 Jan 2002 05:49:07 -0000
@@ -4583,13 +4583,14 @@
 static LRESULT LISTVIEW_FindItemA(HWND hwnd, INT nStart, 
                                   LPLVFINDINFOA lpFindInfo)
 {
+  BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL);
   LVFINDINFOW fiw;
   LRESULT res;
   
   memcpy(&fiw, lpFindInfo, sizeof(fiw));
-  fiw.psz = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE);
+  if (hasText) fiw.psz = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE);
   res = LISTVIEW_FindItemW(hwnd, nStart, &fiw);
-  textfreeT((LPWSTR)fiw.psz, FALSE);
+  if (hasText) textfreeT((LPWSTR)fiw.psz, FALSE);
   return res;
 }
 


More information about the wine-patches mailing list