diff options
Diffstat (limited to 'src')
-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 |