Fixed memoryleaks from indicator button
authorKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Tue, 27 Jul 2010 09:37:51 +0000 (12:37 +0300)
committerKatri Kaikkonen <katri.kaikkonen@ixonos.com>
Tue, 27 Jul 2010 09:37:51 +0000 (12:37 +0300)
Reviewed by: Henri Lampela

src/ui/indicatorbutton.cpp
src/ui/indicatorbutton.h

index 9b3bfdc..124865e 100644 (file)
@@ -91,6 +91,15 @@ IndicatorButton::IndicatorButton(QWidget *parent)
     setCheckable(true);
 }
 
+IndicatorButton::~IndicatorButton()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    delete m_normalColor;
+    delete m_selectedGradient;
+
+}
+
 void IndicatorButton::mousePressEvent(QMouseEvent *event)
 {
     qDebug() << __PRETTY_FUNCTION__;
index 2663607..38705da 100644 (file)
@@ -48,6 +48,12 @@ public:
     */
    IndicatorButton(QWidget *parent = 0);
 
+   /**
+   * @brief Desctructor
+   *
+   */
+   ~IndicatorButton();
+
 /*******************************************************************************
 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
 ******************************************************************************/
@@ -135,18 +141,21 @@ private:
 
     bool m_isDraggable;             ///< Boolean for tracking the draggability state
 
+    QColor *m_normalColor;                  ///< Normal background color
+
+    QLinearGradient *m_selectedGradient;    ///< Selected background
+
+    QPainterPath m_backgroundPath;          ///< Item shape path
+
+    QPixmap m_indicatorLeds[2];             ///< Placeholder for images
+
     QPoint m_dragPosition;          ///< Location from where the widget is grabbed
     QPoint m_eventPosition;         ///< Position of mousePressEvent
 
     QSize m_screenSize;             ///< Store for the screen size
 
     QTimer *m_dragStartTimer;       ///< Timer to init draggability of the distance indicator button
-    QTimer *m_forceReleaseTimer;    ///< Timer to run forceMouseRelease;
-
-    QColor *m_normalColor;
-    QLinearGradient *m_selectedGradient;
-    QPainterPath m_backgroundPath;
-    QPixmap m_indicatorLeds[2];
+    QTimer *m_forceReleaseTimer;    ///< Timer to run forceMouseRelease
 
 };