diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-03-31 08:48:52 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-03-31 08:48:52 (GMT) |
commit | 64cdff9b09b42514ef934e61dccba86834eec9b0 (patch) | |
tree | 67dbe66efb24f93d13d57a3da9ac0a631c3c711c | |
parent | f68ce7374bef952ebc17f1edb7816a3f81044b4a (diff) | |
download | Qt-64cdff9b09b42514ef934e61dccba86834eec9b0.zip Qt-64cdff9b09b42514ef934e61dccba86834eec9b0.tar.gz Qt-64cdff9b09b42514ef934e61dccba86834eec9b0.tar.bz2 |
small change wrt to destruction (patch suggested by ogoffart)
-rw-r--r-- | src/corelib/kernel/qvariant_p.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 72c09ec..a5ba9ff 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -123,11 +123,15 @@ inline void v_construct(QVariant::Private *x, const void *copy, T * = 0) template <class T> inline void v_clear(QVariant::Private *d, T* = 0) { - //now we need to call the destructor in any case - //because QVariant::PrivateShared doesn't have a virtual destructor - v_cast<T>(d)->~T(); - if (sizeof(T) > sizeof(QVariant::Private::Data)) - delete d->data.shared; + + if (sizeof(T) > sizeof(QVariant::Private::Data)) { + //now we need to cast + //because QVariant::PrivateShared doesn't have a virtual destructor + delete static_cast<QVariantPrivateSharedEx<T>*>(d->data.shared); + } else { + v_cast<T>(d)->~T(); + } + } QT_END_NAMESPACE |