Module: wine Branch: master Commit: 279677b7d8419d9ef03a95822c0d9e097c8b6ca1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=279677b7d8419d9ef03a95822c...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Jul 28 15:37:10 2010 +0400
comctl32/treeview: Fix possible crash in TVS_SINGELEXPAND helper (Coverity).
---
dlls/comctl32/tests/treeview.c | 7 +++++++ dlls/comctl32/treeview.c | 2 +- 2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index a0a3e23..5464975 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -1255,6 +1255,13 @@ static void test_TVS_SINGLEEXPAND(void) ok(ret, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_singleexpand_seq, "singleexpand notifications", FALSE);
+ /* a workaround for NT4 that sends expanding notification when nothing is about to expand */ + ret = SendMessageA(hTree, TVM_DELETEITEM, 0, (LPARAM)hRoot); + ok(ret, "got %d\n", ret); + fill_tree(hTree); + ret = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, 0); + ok(ret, "got %d\n", ret); + DestroyWindow(hTree); }
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 3ee1639..e4c465b 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -3426,7 +3426,7 @@ static void TREEVIEW_SingleExpand(TREEVIEW_INFO *infoPtr, { TREEVIEW_ITEM *SelItem;
- if ((infoPtr->dwStyle & TVS_SINGLEEXPAND) == 0 || infoPtr->hwndEdit) return; + if ((infoPtr->dwStyle & TVS_SINGLEEXPAND) == 0 || infoPtr->hwndEdit || !item) return;
TREEVIEW_SendTreeviewNotify(infoPtr, TVN_SINGLEEXPAND, TVC_UNKNOWN, TVIF_HANDLE | TVIF_PARAM, item, 0);