summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-03-31 08:48:52 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-03-31 08:48:52 (GMT)
commit64cdff9b09b42514ef934e61dccba86834eec9b0 (patch)
tree67dbe66efb24f93d13d57a3da9ac0a631c3c711c
parentf68ce7374bef952ebc17f1edb7816a3f81044b4a (diff)
downloadQt-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.h14
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