diff options
author | Volker Krause <volker.krause@kdab.com> | 2016-01-19 09:29:33 +0100 |
---|---|---|
committer | Volker Krause <volker.krause@kdab.com> | 2016-01-19 09:28:47 +0000 |
commit | e2b88264cc623202362bf6221aaa6717c0a57494 (patch) | |
tree | dfc02fd26eb46af5c92bcf0e6f2e0fac129ece7e /tests | |
parent | 8b820e8f93c851c08941a4eead519588d2135c3d (diff) |
Fix resource leaks in ArrayAllocatingPolicy.
Previously we ended up with default constructed elements in the bucket,
and were constructing new ones for every allocation. As some of the types
used in here allocate resources in their ctors themselves we were leaking
those resources.
Now we only construct each element at most once, and we don't construct
any element that is never used. The resulting re-use of elements exposed
the missing cleanup method in tst_ArrayResource.
Change-Id: Ie875fea3ebc9b6f96d0239a6064474fbea798814
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp b/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp index 8d6c49f27..9c91cc579 100644 --- a/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp +++ b/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp @@ -66,9 +66,15 @@ public: tst_ArrayResource() : m_value(0) {} + void cleanup() { m_value = 0; } + QAtomicInt m_value; }; +QT_BEGIN_NAMESPACE +Q_DECLARE_RESOURCE_INFO(tst_ArrayResource, Q_REQUIRES_CLEANUP) +QT_END_NAMESPACE + typedef Qt3DCore::QHandle<tst_ArrayResource> tHandle; typedef Qt3DCore::QHandle<tst_ArrayResource, 4> tHandle4; typedef Qt3DCore::QHandle<tst_ArrayResource, 8> tHandle8; |