fixed various leaks I found using Valgrind
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1220 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
16
ChangeLog
16
ChangeLog
@@ -1,3 +1,19 @@
|
||||
2008-06-30 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* include/automatable_model.h:
|
||||
* include/combobox_model.h:
|
||||
* include/piano_roll.h:
|
||||
* include/mv_base.h:
|
||||
* src/gui/piano_roll.cpp:
|
||||
* src/gui/main_window.cpp:
|
||||
* src/gui/widgets/combobox.cpp:
|
||||
* src/gui/widgets/group_box.cpp:
|
||||
* src/gui/automation_editor.cpp:
|
||||
* src/core/instrument_functions.cpp:
|
||||
* src/core/mv_base.cpp:
|
||||
* src/core/fx_mixer.cpp:
|
||||
fixed various leaks I found using Valgrind
|
||||
|
||||
2008-06-30 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* plugins/ladspa_browser/ladspa_browser.cpp:
|
||||
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
automatableModel( Float, _val, _min, _max, _step,
|
||||
_parent, _display_name, _default_constructed )
|
||||
_parent, _display_name, _default_constructed )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
automatableModel( Integer, _val, _min, _max, 1,
|
||||
_parent, _display_name, _default_constructed )
|
||||
_parent, _display_name, _default_constructed )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
automatableModel( Bool, _val, FALSE, TRUE, 1,
|
||||
_parent, _display_name, _default_constructed )
|
||||
_parent, _display_name, _default_constructed )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -39,11 +39,18 @@ class comboBoxModel : public intModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
comboBoxModel( ::model * _parent = NULL, const QString & _display_name = QString::null ) :
|
||||
comboBoxModel( ::model * _parent = NULL,
|
||||
const QString & _display_name = QString::null,
|
||||
bool _default_constructed = FALSE ) :
|
||||
intModel( 0, 0, 0, _parent, _display_name )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~comboBoxModel()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void addItem( const QString & _item, pixmapLoader * _loader = NULL );
|
||||
|
||||
void clear( void );
|
||||
|
||||
@@ -91,12 +91,15 @@ class EXPORT modelView
|
||||
{
|
||||
public:
|
||||
modelView( model * _model, QWidget * _this );
|
||||
virtual ~modelView()
|
||||
{
|
||||
}
|
||||
virtual ~modelView();
|
||||
|
||||
virtual void setModel( model * _model, bool _old_model_valid = TRUE );
|
||||
|
||||
inline model * getModel( void )
|
||||
{
|
||||
return( m_model );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T * castModel( void )
|
||||
{
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include "types.h"
|
||||
#include "note.h"
|
||||
#include "combobox_model.h"
|
||||
#include "journalling_object.h"
|
||||
#include "note.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
class QPainter;
|
||||
@@ -39,7 +40,6 @@ class QPixmap;
|
||||
class QScrollBar;
|
||||
|
||||
class comboBox;
|
||||
class comboBoxModel;
|
||||
class notePlayHandle;
|
||||
class pattern;
|
||||
class timeLine;
|
||||
@@ -198,9 +198,9 @@ private:
|
||||
comboBox * m_quantizeComboBox;
|
||||
comboBox * m_noteLenComboBox;
|
||||
|
||||
comboBoxModel * m_zoomingModel;
|
||||
comboBoxModel * m_quantizeModel;
|
||||
comboBoxModel * m_noteLenModel;
|
||||
comboBoxModel m_zoomingModel;
|
||||
comboBoxModel m_quantizeModel;
|
||||
comboBoxModel m_noteLenModel;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ fxMixer::fxMixer() :
|
||||
|
||||
fxMixer::~fxMixer()
|
||||
{
|
||||
delete[] m_out;
|
||||
for( int i = 0; i < NumFxChannels+1; ++i )
|
||||
{
|
||||
delete m_fxChannels[i];
|
||||
|
||||
@@ -279,9 +279,12 @@ arpeggiator::arpeggiator( model * _parent ) :
|
||||
m_arpEnabledModel( FALSE ),
|
||||
m_arpModel( this, tr( "Arpeggio type" ) ),
|
||||
m_arpRangeModel( 1.0f, 1.0f, 9.0f, 1.0f, this, tr( "Arpeggio range" ) ),
|
||||
m_arpTimeModel( 100.0f, 25.0f, 2000.0f, 1.0f, 1.0, this, tr( "Arpeggio time" ) ),
|
||||
m_arpGateModel( 100.0f, 1.0f, 200.0f, 1.0f, this, tr( "Arpeggio gate" ) ),
|
||||
m_arpDirectionModel( 0, 0, NumArpDirections, this, tr( "Arpeggio direction" ) ),
|
||||
m_arpTimeModel( 100.0f, 25.0f, 2000.0f, 1.0f, 1.0, this,
|
||||
tr( "Arpeggio time" ) ),
|
||||
m_arpGateModel( 100.0f, 1.0f, 200.0f, 1.0f, this,
|
||||
tr( "Arpeggio gate" ) ),
|
||||
m_arpDirectionModel( 0, 0, NumArpDirections, this,
|
||||
tr( "Arpeggio direction" ) ),
|
||||
m_arpModeModel( this, tr( "Arpeggio mode" ) )
|
||||
{
|
||||
for( int i = 0; chordCreator::s_chordTable[i].interval[0] != -1; ++i )
|
||||
|
||||
@@ -53,6 +53,7 @@ QString model::fullDisplayName( void ) const
|
||||
|
||||
|
||||
|
||||
|
||||
modelView::modelView( model * _model, QWidget * _this ) :
|
||||
m_widget( _this ),
|
||||
m_model( _model )
|
||||
@@ -62,6 +63,17 @@ modelView::modelView( model * _model, QWidget * _this ) :
|
||||
|
||||
|
||||
|
||||
modelView::~modelView()
|
||||
{
|
||||
if( m_model != NULL && m_model->defaultConstructed() )
|
||||
{
|
||||
delete m_model;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void modelView::setModel( model * _model, bool _old_model_valid )
|
||||
{
|
||||
if( _old_model_valid && m_model != NULL )
|
||||
|
||||
@@ -308,6 +308,7 @@ automationEditor::automationEditor( void ) :
|
||||
m_quantizeComboBox = new comboBox( m_toolBar );
|
||||
m_quantizeComboBox->setFixedSize( 60, 22 );
|
||||
|
||||
// TODO: leak
|
||||
comboBoxModel * quantize_model = new comboBoxModel( /* this */ );
|
||||
for( int i = 0; i < 7; ++i )
|
||||
{
|
||||
|
||||
@@ -161,6 +161,13 @@ mainWindow::mainWindow( void ) :
|
||||
|
||||
mainWindow::~mainWindow()
|
||||
{
|
||||
for( QList<pluginView *>::iterator it = m_tools.begin();
|
||||
it != m_tools.end(); ++it )
|
||||
{
|
||||
model * m = ( *it )->getModel();
|
||||
delete *it;
|
||||
delete m;
|
||||
}
|
||||
// TODO: Close tools
|
||||
// destroy engine which will do further cleanups etc.
|
||||
engine::destroy();
|
||||
|
||||
@@ -127,9 +127,9 @@ const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DefaultStepsPerTact;
|
||||
|
||||
|
||||
pianoRoll::pianoRoll( void ) :
|
||||
m_zoomingModel( new comboBoxModel( /* this */ ) ),
|
||||
m_quantizeModel( new comboBoxModel( /* this */ ) ),
|
||||
m_noteLenModel( new comboBoxModel( /* this */ ) ),
|
||||
m_zoomingModel(),
|
||||
m_quantizeModel(),
|
||||
m_noteLenModel(),
|
||||
m_pattern( NULL ),
|
||||
m_currentPosition(),
|
||||
m_recording( FALSE ),
|
||||
@@ -359,13 +359,13 @@ pianoRoll::pianoRoll( void ) :
|
||||
// setup zooming-stuff
|
||||
for( int i = 0; i < 6; ++i )
|
||||
{
|
||||
m_zoomingModel->addItem( QString::number( 25 << i ) + "%" );
|
||||
m_zoomingModel.addItem( QString::number( 25 << i ) + "%" );
|
||||
}
|
||||
m_zoomingModel->setValue( m_zoomingModel->findText( "100%" ) );
|
||||
connect( m_zoomingModel, SIGNAL( dataChanged() ),
|
||||
m_zoomingModel.setValue( m_zoomingModel.findText( "100%" ) );
|
||||
connect( &m_zoomingModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( zoomingChanged() ) );
|
||||
m_zoomingComboBox = new comboBox( m_toolBar );
|
||||
m_zoomingComboBox->setModel( m_zoomingModel );
|
||||
m_zoomingComboBox->setModel( &m_zoomingModel );
|
||||
m_zoomingComboBox->setFixedSize( 80, 22 );
|
||||
|
||||
|
||||
@@ -375,12 +375,12 @@ pianoRoll::pianoRoll( void ) :
|
||||
|
||||
for( int i = 0; i < 7; ++i )
|
||||
{
|
||||
m_quantizeModel->addItem( "1/" + QString::number( 1 << i ) );
|
||||
m_quantizeModel.addItem( "1/" + QString::number( 1 << i ) );
|
||||
}
|
||||
m_quantizeModel->addItem( "1/192" );
|
||||
m_quantizeModel->setValue( m_quantizeModel->findText( "1/16" ) );
|
||||
m_quantizeModel.addItem( "1/192" );
|
||||
m_quantizeModel.setValue( m_quantizeModel.findText( "1/16" ) );
|
||||
m_quantizeComboBox = new comboBox( m_toolBar );
|
||||
m_quantizeComboBox->setModel( m_quantizeModel );
|
||||
m_quantizeComboBox->setModel( &m_quantizeModel );
|
||||
m_quantizeComboBox->setFixedSize( 60, 22 );
|
||||
|
||||
|
||||
@@ -388,19 +388,19 @@ pianoRoll::pianoRoll( void ) :
|
||||
QLabel * note_len_lbl = new QLabel( m_toolBar );
|
||||
note_len_lbl->setPixmap( embed::getIconPixmap( "note" ) );
|
||||
|
||||
m_noteLenModel->addItem( tr( "Last note" ),
|
||||
m_noteLenModel.addItem( tr( "Last note" ),
|
||||
new pixmapLoader( "edit_draw" ) );
|
||||
const QString pixmaps[] = { "whole", "half", "quarter", "eighth",
|
||||
"sixteenth", "thirtysecond" } ;
|
||||
for( int i = 0; i < 6; ++i )
|
||||
{
|
||||
m_noteLenModel->addItem( "1/" + QString::number( 1 << i ),
|
||||
m_noteLenModel.addItem( "1/" + QString::number( 1 << i ),
|
||||
new pixmapLoader( "note_" + pixmaps[i] ) );
|
||||
}
|
||||
m_noteLenModel->addItem( "1/192" );
|
||||
m_noteLenModel->setValue( 0 );
|
||||
m_noteLenModel.addItem( "1/192" );
|
||||
m_noteLenModel.setValue( 0 );
|
||||
m_noteLenComboBox = new comboBox( m_toolBar );
|
||||
m_noteLenComboBox->setModel( m_noteLenModel );
|
||||
m_noteLenComboBox->setModel( &m_noteLenModel );
|
||||
m_noteLenComboBox->setFixedSize( 120, 22 );
|
||||
|
||||
|
||||
@@ -2150,8 +2150,8 @@ void pianoRoll::wheelEvent( QWheelEvent * _we )
|
||||
m_ppt /= 2;
|
||||
}
|
||||
// update combobox with zooming-factor
|
||||
m_zoomingModel->setValue(
|
||||
m_zoomingModel->findText( QString::number(
|
||||
m_zoomingModel.setValue(
|
||||
m_zoomingModel.findText( QString::number(
|
||||
static_cast<int>( m_ppt * 100 /
|
||||
DEFAULT_PR_PPT ) ) +"%" ) );
|
||||
// update timeline
|
||||
@@ -2652,7 +2652,7 @@ void pianoRoll::updatePosition( const midiTime & _t )
|
||||
|
||||
void pianoRoll::zoomingChanged( void )
|
||||
{
|
||||
const QString & zfac = m_zoomingModel->currentText();
|
||||
const QString & zfac = m_zoomingModel.currentText();
|
||||
m_ppt = zfac.left( zfac.length() - 1 ).toInt() * DEFAULT_PR_PPT / 100;
|
||||
#ifdef LMMS_DEBUG
|
||||
assert( m_ppt > 0 );
|
||||
@@ -2667,8 +2667,8 @@ void pianoRoll::zoomingChanged( void )
|
||||
|
||||
int pianoRoll::quantization( void ) const
|
||||
{
|
||||
return( DefaultTicksPerTact / m_quantizeModel->currentText().right(
|
||||
m_quantizeModel->currentText().length() -
|
||||
return( DefaultTicksPerTact / m_quantizeModel.currentText().right(
|
||||
m_quantizeModel.currentText().length() -
|
||||
2 ).toInt() );
|
||||
}
|
||||
|
||||
@@ -2677,12 +2677,12 @@ int pianoRoll::quantization( void ) const
|
||||
|
||||
midiTime pianoRoll::newNoteLen( void ) const
|
||||
{
|
||||
if( m_noteLenModel->value() == 0 )
|
||||
if( m_noteLenModel.value() == 0 )
|
||||
{
|
||||
return( m_lenOfNewNotes );
|
||||
}
|
||||
return( midiTime::ticksPerTact() / m_noteLenModel->currentText().right(
|
||||
m_noteLenModel->currentText().length() -
|
||||
return( midiTime::ticksPerTact() / m_noteLenModel.currentText().right(
|
||||
m_noteLenModel.currentText().length() -
|
||||
2 ).toInt() );
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ const int CB_ARROW_BTN_WIDTH = 20;
|
||||
|
||||
comboBox::comboBox( QWidget * _parent, const QString & _name ) :
|
||||
QWidget( _parent ),
|
||||
intModelView( new comboBoxModel, this ),
|
||||
intModelView( new comboBoxModel( NULL, QString::null, TRUE ), this ),
|
||||
m_menu( this ),
|
||||
m_pressed( FALSE )
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
|
||||
m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) );
|
||||
m_led->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
|
||||
|
||||
setModel( new boolModel( FALSE, NULL, _caption, FALSE ) );
|
||||
setModel( new boolModel( FALSE, NULL, _caption, TRUE ) );
|
||||
setAutoFillBackground( TRUE );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user