aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-08-07 10:18:14 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-08 05:02:55 +0000
commitd83d955397ac2f68ebf39a66ced222a61fd10029 (patch)
treef6b4a2682d11b31fe09eb4a1026f6693ac362ccd /src/qml/types
parent4853a19644aab6497953b53947e364bfdff7d285 (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/types')
-rw-r--r--src/qml/types/qqmllistmodel.cpp5
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)