Mikołaj Zalewski : comctl32: header: Don' t modify the user supplied HDITEM during Set/InsertItem.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 15 09:42:28 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 16fefcd6d9cb8d364c472d797a64ae08cd246620
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=16fefcd6d9cb8d364c472d797a64ae08cd246620

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Sat May 13 21:14:43 2006 +0200

comctl32: header: Don't modify the user supplied HDITEM during Set/InsertItem.

---

 dlls/comctl32/header.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 99c19d0..7d0aeb5 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -131,22 +131,21 @@ static void HEADER_StoreHDItemInHeader(H
 
     if (phdi->mask & HDI_TEXT)
     {
-        if (!phdi->pszText) phdi->pszText = emptyString; /* null pointer check */
         if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
         {
+            LPWSTR pszText;
             if (lpItem->pszText)
             {
                 if (lpItem->pszText != emptyString && lpItem->pszText != LPSTR_TEXTCALLBACKW)
                     Free(lpItem->pszText);
                 lpItem->pszText = NULL;
             }
-            if (phdi->pszText)
-            {
-                if (fUnicode)
-                    Str_SetPtrW(&lpItem->pszText, phdi->pszText);
-                else
-                    Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)phdi->pszText);
-            }
+
+            pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString);
+            if (fUnicode)
+                Str_SetPtrW(&lpItem->pszText, pszText);
+            else
+                Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)pszText);
         }
         else
         {




More information about the wine-cvs mailing list