Skip to content

ScrollBar: fix crash on exit when flickable created before ScrollView

In the case from the related QTBUG-106118, the ListView is declared before the ScrollView, so when the QObject destruction happens, it gets destroyed first. The ScrollView being destroyed causes the attached ScrollBar object to be destroyed, which causes the attached object to access the flickable (ListView) which has already been destroyed. So a workaround for the crash is to declare the ListView after the ScrollView.

With typical usage where ScrollView is used as-is, ScrollView (and hence QQuickScrollBarAttached) is destroyed before the flickable.

This patch also adds a PRINT_LISTENERS debugging helper, as item change listener crashes can be difficult to debug.

Fixes: QTBUG-106106 Pick-to: 6.2 6.4 Change-Id: I8d0d5544ea28c1f1557abdc38d48b26d21a7f1f5 Reviewed-by: Volker Hilsheimer volker.hilsheimer@qt.io Reviewed-by: Shawn Rutledge shawn.rutledge@qt.io

Manually cherry-picked from c6f51533d9d2aadd3441b3292b6ab5435c35a03b @ qtdeclarative. Due to split repo in Qt 5 branch, second part of that patch is to be merged in qtdeclarative.

Merge request reports