From dbe8d58331a5e18711f2875bbf8180cea10caca9 Mon Sep 17 00:00:00 2001 From: Stefano Bonicatti Date: Sun, 19 Jul 2020 21:31:39 +0200 Subject: [PATCH] Avoid leaking the track grip QPixmap at each paintEvent Given that s_grip is not used anywhere else we remove it and instead of allocating every paintEvent a new QPixmap on the heap, which is constructed from the cached pixmap, to then leak it, we just pass the cached pixmap directly. --- include/Track.h | 2 -- src/core/Track.cpp | 14 ++------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/include/Track.h b/include/Track.h index 89c95059cf9..ff0e3ef88bf 100644 --- a/include/Track.h +++ b/include/Track.h @@ -459,8 +459,6 @@ private slots: void clearTrack(); private: - static QPixmap * s_grip; - TrackView * m_trackView; QPushButton * m_trackOps; diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 0133169ed5e..734cb4e12d9 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -1830,10 +1830,6 @@ void TrackContentWidget::setEmbossColor( const QBrush & c ) // trackOperationsWidget // =========================================================================== - -QPixmap * TrackOperationsWidget::s_grip = NULL; /*!< grip pixmap */ - - /*! \brief Create a new trackOperationsWidget * * The trackOperationsWidget is the grip and the mute button of a track. @@ -1960,17 +1956,11 @@ void TrackOperationsWidget::paintEvent( QPaintEvent * pe ) if( m_trackView->isMovingTrack() == false ) { - s_grip = new QPixmap( embed::getIconPixmap( - "track_op_grip" ) ); - - p.drawPixmap( 2, 2, *s_grip ); + p.drawPixmap( 2, 2, embed::getIconPixmap("track_op_grip")); } else { - s_grip = new QPixmap( embed::getIconPixmap( - "track_op_grip_c" ) ); - - p.drawPixmap( 2, 2, *s_grip ); + p.drawPixmap( 2, 2, embed::getIconPixmap("track_op_grip_c")); } }