Commit d6ea1bf1 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

comctl32: Check subitem is valid before calling LISTVIEW_InvalidateSubItem().

parent 2d097f70
......@@ -3573,7 +3573,7 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, B
HWND hwndSelf = infoPtr->hwndSelf;
LPWSTR pszText = NULL;
BOOL bResult, bChanged = FALSE;
TRACE("(lpLVItem=%s, isW=%d)\n", debuglvitem_t(lpLVItem, isW), isW);
if (!lpLVItem || lpLVItem->iItem < 0 || lpLVItem->iItem >= infoPtr->nItemCount)
......@@ -3585,10 +3585,10 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, B
pszText = lpLVItem->pszText;
((LVITEMW *)lpLVItem)->pszText = textdupTtoW(lpLVItem->pszText, isW);
}
/* actually set the fields */
if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return FALSE;
if (lpLVItem->iSubItem)
bResult = set_sub_item(infoPtr, lpLVItem, TRUE, &bChanged);
else
......@@ -3601,7 +3601,8 @@ static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, B
{
/* this little optimization eliminates some nasty flicker */
if ( uView == LVS_REPORT && !(infoPtr->dwStyle & LVS_OWNERDRAWFIXED) &&
(!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) || lpLVItem->iSubItem) )
!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) &&
lpLVItem->iSubItem > 0 && lpLVItem->iSubItem <= DPA_GetPtrCount(infoPtr->hdpaColumns) )
LISTVIEW_InvalidateSubItem(infoPtr, lpLVItem->iItem, lpLVItem->iSubItem);
else
LISTVIEW_InvalidateItem(infoPtr, lpLVItem->iItem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment