diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-12-10 14:55:14 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-12-11 20:12:23 +0100 |
commit | c15d6a155c6121bad68a3ec60be62181fb92d0f8 (patch) | |
tree | 458e2a44d19ba6ecf1c5493dc64d9504a6f4bc71 /src/corelib/kernel/qvariant_p.h | |
parent | 07838840e86a5fb7f81520bb2a31d16f80e51e4c (diff) |
QVariant: introduce ShouldDeleteVariantData flag
This flag is used in QSequentialIterable and QAssociativeIterable to indicate
that the data pointer in VariantData should be deleted after the variant has
been constructed.
The use case for this is
https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have
a proxy iterator and cannot easily return a pointer to already owned data, as
it is hard to manage its lifetime in the iterator. In contrast, it is clear
that we can release the memory in the QSequentialIterable functions, as it has
already been copied into the QVariant there.
Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qvariant_p.h')
-rw-r--r-- | src/corelib/kernel/qvariant_p.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 3d87beac83..b8b63b5e6f 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -105,6 +105,11 @@ inline T *v_cast(QVariant::Private *d, T * = nullptr) #endif +enum QVariantConstructionFlags : uint { + Default = 0x0, + PointerType = 0x1, + ShouldDeleteVariantData = 0x2 // only used in Q*Iterable +}; //a simple template that avoids to allocate 2 memory chunks when creating a QVariant template <class T> class QVariantPrivateSharedEx : public QVariant::PrivateShared |