[1/5] comctl32/listview: Fix a regression caused by 9c1a0e468f5cfbe9d863852ed5a42390f2cbfeb4

Nikolay Sivov bunglehead at gmail.com
Mon Apr 20 02:54:27 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=18090

Commit 9c1a0e468f5cfbe9d863852ed5a42390f2cbfeb4 introduced a regression
for LVS_OWNERDATA style - crash after item state changing.
NULL pointer used fot LVS_OWNERDATA case. Since now we're storing
LVIS_FOCUSED and LVIS_SELECTED sates move state storing at a single place.

Changelog:
    - Fix regression caused by 9c1a0e468f5cfbe9d863852ed5a42390f2cbfeb4

>From 21b685b09c20c5c635dedb9340fd92cb1c02ba52 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun, 19 Apr 2009 18:21:50 -0400
Subject: Fix a regression caused by 9c1a0e468f5cfbe9d863852ed5a42390f2cbfeb4

---
 dlls/comctl32/listview.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index d594e51..cfd9f3e 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -3566,7 +3566,7 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
 
     if (uChanged & LVIF_STATE)
     {
-	if (lpItem && (stateMask & ~infoPtr->uCallbackMask & ~(LVIS_FOCUSED | LVIS_SELECTED)))
+	if (lpItem && (stateMask & ~infoPtr->uCallbackMask))
 	{
 	    lpItem->state &= ~stateMask;
 	    lpItem->state |= (lpLVItem->state & stateMask);
@@ -3575,12 +3575,10 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
 	{
 	    if (infoPtr->dwStyle & LVS_SINGLESEL) LISTVIEW_DeselectAllSkipItem(infoPtr, lpLVItem->iItem);
 	    ranges_additem(infoPtr->selectionRanges, lpLVItem->iItem);
-	    lpItem->state |= LVIS_SELECTED;
 	}
 	else if (stateMask & LVIS_SELECTED)
 	{
 	    ranges_delitem(infoPtr->selectionRanges, lpLVItem->iItem);
-	    lpItem->state &= ~LVIS_SELECTED;
 	}
 	/* if we are asked to change focus, and we manage it, do it */
 	if (stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED)
@@ -3598,13 +3596,11 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL
 		    LISTVIEW_SetItemState(infoPtr, infoPtr->nFocusedItem, &item);
 		}
 
-		lpItem->state |= LVIS_FOCUSED;
 		infoPtr->nFocusedItem = lpLVItem->iItem;
     	        LISTVIEW_EnsureVisible(infoPtr, lpLVItem->iItem, uView == LVS_LIST);
 	    }
 	    else if (infoPtr->nFocusedItem == lpLVItem->iItem)
 	    {
-	        lpItem->state &= ~LVIS_FOCUSED;
 	        infoPtr->nFocusedItem = -1;
 	    }
 	}
-- 
1.5.6.5





More information about the wine-patches mailing list