summaryrefslogtreecommitdiff
path: root/src/controls/Private/qquickstyleitem.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2016-04-25 12:26:24 +0200
committerAlbert Astals Cid <albert.astals@canonical.com>2016-05-11 14:30:17 +0000
commita0bedbc0461e6ecb45591708616f4437ea7a634f (patch)
tree785e4174f5fa76b453fd9593cb9b56947a09416e /src/controls/Private/qquickstyleitem.cpp
parentbc750f8f77072b0279fea1e59601c56969a67df5 (diff)
downloadqtquickcontrols-a0bedbc0461e6ecb45591708616f4437ea7a634f.tar.gz
Delete the m_styleoption properly
Unfortunately the destructor of QStyleOption is not virtual so you need to cast them all individually otherwise the wrong destructor is called Change-Id: I3b07450438d98910fbbff9f81234876551ed4e5d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/controls/Private/qquickstyleitem.cpp')
-rw-r--r--src/controls/Private/qquickstyleitem.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/controls/Private/qquickstyleitem.cpp b/src/controls/Private/qquickstyleitem.cpp
index 2fca6be6..d7d2d4c3 100644
--- a/src/controls/Private/qquickstyleitem.cpp
+++ b/src/controls/Private/qquickstyleitem.cpp
@@ -274,7 +274,39 @@ QQuickStyleItem::QQuickStyleItem(QQuickItem *parent)
QQuickStyleItem::~QQuickStyleItem()
{
- delete m_styleoption;
+ if (const QStyleOptionButton *aux = qstyleoption_cast<const QStyleOptionButton*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionViewItem *aux = qstyleoption_cast<const QStyleOptionViewItem*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionHeader *aux = qstyleoption_cast<const QStyleOptionHeader*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionToolButton *aux = qstyleoption_cast<const QStyleOptionToolButton*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionToolBar *aux = qstyleoption_cast<const QStyleOptionToolBar*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionTab *aux = qstyleoption_cast<const QStyleOptionTab*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionFrame *aux = qstyleoption_cast<const QStyleOptionFrame*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionFocusRect *aux = qstyleoption_cast<const QStyleOptionFocusRect*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionTabWidgetFrame *aux = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionMenuItem *aux = qstyleoption_cast<const QStyleOptionMenuItem*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionComboBox *aux = qstyleoption_cast<const QStyleOptionComboBox*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionSpinBox *aux = qstyleoption_cast<const QStyleOptionSpinBox*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionSlider *aux = qstyleoption_cast<const QStyleOptionSlider*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionProgressBar *aux = qstyleoption_cast<const QStyleOptionProgressBar*>(m_styleoption))
+ delete aux;
+ else if (const QStyleOptionGroupBox *aux = qstyleoption_cast<const QStyleOptionGroupBox*>(m_styleoption))
+ delete aux;
+ else
+ delete m_styleoption;
+
m_styleoption = 0;
}