Avoid setting infoPtr->firstVisible to NULL in TREEVIEW_Sort

Dmitry Timoshkov dmitry at baikal.ru
Wed Nov 12 01:48:16 CST 2003


Hello,

since nobody commented on the patch on wine-devel, here it is.

Previously TREEVIEW_Sort refused to accept NULL parent
and this scenario simply didn't happen. Now NULL parent
is accepted and treated as TVI_ROOT, and the whole tree
gets sorted.

Setting infoPtr->firstVisible to NULL in TREEVIEW_Sort
leads to a crash when later on this field is dereferenced.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Avoid setting infoPtr->firstVisible to NULL in TREEVIEW_Sort.

--- cvs/hq/wine/dlls/comctl32/treeview.c	Mon Oct 20 13:17:07 2003
+++ wine/dlls/comctl32/treeview.c	Wed Nov 12 15:21:41 2003
@@ -3063,6 +3063,7 @@ TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BO
 	                break;
 	        }
 
+                if (!item) item = parent->firstChild;
                 TREEVIEW_SetFirstVisible(infoPtr, item, FALSE);
 	    }
 
@@ -5185,6 +5186,9 @@ static LRESULT WINAPI
 TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
+
+    TRACE("hwnd %p msg %04x wp=%08x lp=%08lx\n", hwnd, uMsg, wParam, lParam);
+
     if (infoPtr) TREEVIEW_VerifyTree(infoPtr);
     else
     {






More information about the wine-patches mailing list