From ee0a9772cdafce6a85f9bdafa769f76ec0eee0ca Mon Sep 17 00:00:00 2001 From: wj32 Date: Tue, 28 Sep 2010 22:28:49 +0000 Subject: [PATCH] avoid using ListView_SetItemCountEx - fixes tooltips disappearing when process tree is being sorted git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3688 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- 2.x/trunk/phlib/treelist.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/2.x/trunk/phlib/treelist.c b/2.x/trunk/phlib/treelist.c index 015dd5444..78df47013 100644 --- a/2.x/trunk/phlib/treelist.c +++ b/2.x/trunk/phlib/treelist.c @@ -1700,12 +1700,15 @@ static VOID PhpRestructureNodes( PPH_TREELIST_NODE *children; ULONG numberOfChildren; ULONG i; + ULONG oldCount; if (!PhpGetNodeChildren(Context, NULL, &children, &numberOfChildren)) return; // At this point we rebuild the entire list. + oldCount = Context->List->Count; + PhClearList(Context->List); Context->CanAnyExpand = FALSE; @@ -1714,7 +1717,11 @@ static VOID PhpRestructureNodes( PhpInsertNodeChildren(Context, children[i], 0); } - ListView_SetItemCountEx(Context->ListViewHandle, Context->List->Count, LVSICF_NOSCROLL); + // Avoid using ListView_SetItemCountEx if we can. + if (Context->List->Count != oldCount) + ListView_SetItemCountEx(Context->ListViewHandle, Context->List->Count, LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL); + else + InvalidateRect(Context->ListViewHandle, NULL, TRUE); } static INT PhpInsertColumn(