Commit d65ad9ba authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: kill memleak on the special sound slider

parent 380d2c8c
...@@ -62,13 +62,14 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, ...@@ -62,13 +62,14 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
if( !b_special ) if( !b_special )
{ {
volumeMenu = NULL; subLayout = NULL; volumeMenu = NULL; subLayout = NULL;
volumeControlWidget = NULL;
} }
else else
{ {
/* Special view, click on button shows the slider */ /* Special view, click on button shows the slider */
b_shiny = false; b_shiny = false;
QFrame *volumeControlWidget = new QFrame; volumeControlWidget = new QFrame;
subLayout = new QVBoxLayout( volumeControlWidget ); subLayout = new QVBoxLayout( volumeControlWidget );
subLayout->setLayoutMargins( 4, 4, 4, 4, 4 ); subLayout->setLayoutMargins( 4, 4, 4, 4, 4 );
volumeMenu = new QMenu( this ); volumeMenu = new QMenu( this );
...@@ -121,6 +122,12 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, ...@@ -121,6 +122,12 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) ); CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) );
} }
SoundWidget::~SoundWidget()
{
delete volumeSlider;
delete volumeControlWidget;
}
void SoundWidget::updateVolume( int i_sliderVolume ) void SoundWidget::updateVolume( int i_sliderVolume )
{ {
if( !b_my_volume ) if( !b_my_volume )
......
...@@ -68,11 +68,13 @@ class SoundWidget : public QWidget ...@@ -68,11 +68,13 @@ class SoundWidget : public QWidget
public: public:
SoundWidget( QWidget *parent, intf_thread_t *_p_i, bool, SoundWidget( QWidget *parent, intf_thread_t *_p_i, bool,
bool b_special = false ); bool b_special = false );
virtual ~SoundWidget();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QLabel *volMuteLabel; QLabel *volMuteLabel;
QAbstractSlider *volumeSlider; QAbstractSlider *volumeSlider;
QFrame *volumeControlWidget;
bool b_my_volume; bool b_my_volume;
QMenu *volumeMenu; QMenu *volumeMenu;
virtual bool eventFilter( QObject *obj, QEvent *e ); virtual bool eventFilter( QObject *obj, QEvent *e );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment