BListView: Do not call virtual ScrollTo(BPoint) method in ScrollTo(index).

ScrollTo(index) was introduced only in 82bfaa954d,
in the implementation of autoscroll-on-drag. But if we call the virtual
methods from here, subclasses might recurse back into us when calling
other methods (MouseMoved() in particular), so in order to avoid
an infinite recursion we have to call ourselves explicitly here.

Fixes a crash on drag in list views in WonderBrush.

Change-Id: Ie7a1bbb75161815bac1f5a800c9ba5830ac43a0f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8014
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: John Scipione <jscipione@gmail.com>
This commit is contained in:
Augustin Cavalier 2024-08-13 18:47:46 -04:00 committed by waddlesplash
parent cb92249c88
commit b3a64f5856

View File

@ -1235,9 +1235,9 @@ BListView::ScrollTo(int32 index)
BRect itemFrame = ItemFrame(index);
BRect bounds = Bounds();
if (itemFrame.top < bounds.top)
ScrollTo(itemFrame.LeftTop());
BListView::ScrollTo(itemFrame.LeftTop());
else if (itemFrame.bottom > bounds.bottom)
ScrollTo(BPoint(0, itemFrame.bottom - bounds.Height()));
BListView::ScrollTo(BPoint(0, itemFrame.bottom - bounds.Height()));
}