From d83d955397ac2f68ebf39a66ced222a61fd10029 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 7 Aug 2018 10:18:14 +0200 Subject: 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 --- src/qml/types/qqmllistmodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/qml/types/qqmllistmodel.cpp') 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) -- cgit v1.2.3