diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-07 10:18:14 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-08-08 05:02:55 +0000 |
commit | d83d955397ac2f68ebf39a66ced222a61fd10029 (patch) | |
tree | f6b4a2682d11b31fe09eb4a1026f6693ac362ccd /src/qml | |
parent | 4853a19644aab6497953b53947e364bfdff7d285 (diff) |
Fix ASAN error about new-delete-size mismatch
When object cache for list model items is a plain QObject that was
allocated together with declarative data in one go. Since we control the
site of deletion, we can call the destructor manually as well as
operator delete to avoid the ASAN error.
Change-Id: I346d6ef34876cb495573ba9cfbc68be92dd937ab
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 8d1ea6f828..282977e95e 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1354,7 +1354,10 @@ void ListElement::destroy(ListLayout *layout) } } - delete m_objectCache; + if (m_objectCache) { + m_objectCache->~QObject(); + operator delete(m_objectCache); + } } if (next) |