Listview updates (G0)

Dimitrie O. Paun dpaun at rogers.com
Sat Sep 28 16:08:30 CDT 2002


On September 28, 2002 03:19 pm, Paul Rupe wrote:
> With these two ZeroMemory calls removed, I'm getting crashes in Xnews due
> to the uninitialized pszText member.  In both cases, it happens when
> LISTVIEW_GetItemT gets the LVITEMW structure and calls notify_dispinfoT

Which means that notify_dispinfoT is broken. This way we find the bug,
which is my point exactly against adding this zero memory calls. Not only
they bloat the code, making it slower, harder to read, etc., but most
importantly they hide exactly this types of bugs. We can not go "easy" on
our functions by zeroing the memory first, because the exact same functions
will be called by app code, and there we have no guarantees that the app
will clear the memory before hand. We have to make our functions work 
properly in the most harsh, documented environment.

Thanks for spotting it. Here's the fix (relative to H0):

--- dlls/comctl32/listview.c.H0 Fri Sep 27 15:58:32 2002
+++ dlls/comctl32/listview.c    Sat Sep 28 16:43:12 2002
@@ -601,7 +601,7 @@
   else
     realNotifCode = notificationCode;

-  if (is_textT(pdi->item.pszText, isW))
+  if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW))
   {
     if (isW && infoPtr->notifyFormat == NFR_ANSI)
         convertToAnsi = TRUE;


-- 
Dimi.




More information about the wine-devel mailing list