From 64cdff9b09b42514ef934e61dccba86834eec9b0 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 31 Mar 2009 10:48:52 +0200 Subject: small change wrt to destruction (patch suggested by ogoffart) --- src/corelib/kernel/qvariant_p.h | 14 +++++++++----- 1 file 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 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(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*>(d->data.shared); + } else { + v_cast(d)->~T(); + } + } QT_END_NAMESPACE -- cgit v0.12