-
Bug
-
Resolution: Done
-
P2: Important
-
5.8
-
None
-
1) build qtbase 5.8 from git with ASAN and UBSAN (I'm using clang 3.8.1)
2) build and run the {{tests/auto/gui/itemmodels/qstandarditem/tst_qstandarditem parent}} autotest, observe its output
-
88b6abcebf29b455438d8da7db9fd5aa1aed2bf5
When a QStandardItemModel is destroyed and the execution reaches the ~QObject() destructor, it goes on to clean all of the QObject children, including the top-level QStandardItemModel instances. Their respective destructors ~QStandardItemPrivate calls setModel(0) on all of their children.
QStandardItemModel::setModel, however, calls back to the original model's invalidatePersistentIndex. This is undefined behavior because the ~QStandardItemModel has already finished, and that object is not even QObject anymore.