QAbstractItemView: Fix UB (invalid downcast)
Just use QWidgetPrivate::get() instead. Fixes UBSan error: qabstractitemview.cpp:3814:61: runtime error: downcast of address 0x2b859001aa70 which does not point to an object of type 'QAbstractItemView' 0x2b859001aa70: note: object is of type 'QWidget' Change-Id: I0460fd8a0681e122d440755ebf07018d273b93f8 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
068ce0b10c
commit
8740a87841
@ -3821,7 +3821,7 @@ void QAbstractItemView::doAutoScroll()
|
||||
int horizontalValue = horizontalScroll->value();
|
||||
|
||||
QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());
|
||||
QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules
|
||||
QRect area = QWidgetPrivate::get(d->viewport)->clipRect();
|
||||
|
||||
// do the scrolling if we are in the scroll margins
|
||||
if (pos.y() - area.top() < margin)
|
||||
|
Loading…
Reference in New Issue
Block a user