In TREEVIEW_Collapse the TREEVIEW_SendExpanding call could change the item->firstChild value, therefore check it before for early return.
From: Thomas Csovcsity thc.fr13nd@gmail.com
In TREEVIEW_Collapse the TREEVIEW_SendExpanding call could change the item->firstChild value, therefore check it before for early return.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=23077 --- dlls/comctl32/treeview.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index fb06a727748..eebf5e1f0bb 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -3392,12 +3392,17 @@ TREEVIEW_Collapse(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, if (!TREEVIEW_HasChildren(infoPtr, item)) return FALSE;
- if (bUser && TREEVIEW_SendExpanding(infoPtr, item, action)) - return TRUE; - + /* + * the child items may not actually exist, they could be virtual. + * Just use item->firstChild to check for physical children, + * before TREEVIEW_SendExpanding may change it. + */ if (item->firstChild == NULL) return FALSE;
+ if (bUser && TREEVIEW_SendExpanding(infoPtr, item, action)) + return TRUE; + wasExpanded = (item->state & TVIS_EXPANDED) != 0; item->state &= ~TVIS_EXPANDED;