fixed more leaks

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1221 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-06-30 12:38:35 +00:00
parent fcfb02fbaa
commit 7d8a15f2db
7 changed files with 40 additions and 16 deletions

View File

@@ -2,16 +2,21 @@
* include/automatable_model.h:
* include/combobox_model.h:
* include/piano_roll.h:
* include/mv_base.h:
* src/gui/piano_roll.cpp:
* include/piano_roll.h:
* src/core/base64.cpp:
* src/core/effect.cpp:
* src/core/engine.cpp:
* src/core/fx_mixer.cpp:
* src/core/instrument_functions.cpp:
* src/core/ladspa_manager.cpp:
* src/core/mv_base.cpp:
* src/gui/automation_editor.cpp:
* src/gui/main_window.cpp:
* src/gui/piano_roll.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:
* plugins/ladspa_effect/ladspa_effect.cpp:
fixed various leaks I found using Valgrind
2008-06-30 Paul Giblock <drfaygo/at/gmail/dot/com>

View File

@@ -27,6 +27,7 @@
#define _MV_BASE_H
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include "export.h"
@@ -97,19 +98,24 @@ public:
inline model * getModel( void )
{
return( m_model );
return( m_model.data() );
}
inline const model * getModel( void ) const
{
return( m_model.data() );
}
template<class T>
T * castModel( void )
{
return( dynamic_cast<T *>( m_model ) );
return( dynamic_cast<T *>( getModel() ) );
}
template<class T>
const T * castModel( void ) const
{
return( dynamic_cast<T *>( m_model ) );
return( dynamic_cast<const T *>( getModel() ) );
}
@@ -129,7 +135,7 @@ protected:
private:
QWidget * m_widget;
model * m_model;
QPointer<model> m_model;
} ;

View File

@@ -325,7 +325,7 @@ void ladspaEffect::pluginInstantiation( void )
}
else
{
p->buffer = new LADSPA_Data;
p->buffer = new LADSPA_Data[1];
if( manager->isPortInput( m_key, port ) )
{
@@ -510,8 +510,8 @@ void ladspaEffect::pluginDestruction( void )
manager->cleanup( m_key, m_handles[proc] );
for( int port = 0; port < m_portCount; port++ )
{
free( m_ports[proc][port]->buffer );
free( m_ports[proc][port] );
delete[] m_ports[proc][port]->buffer;
delete m_ports[proc][port];
}
m_ports[proc].clear();
}

View File

@@ -69,6 +69,7 @@ QVariant decode( const QString & _b64, QVariant::Type _force_type )
in.setVersion( QDataStream::Qt_3_3 );
in >> ret;
}
delete[] dst;
return( ret );
}

View File

@@ -56,6 +56,13 @@ effect::effect( const plugin::descriptor * _desc,
effect::~effect()
{
for( int i = 0; i < 2; ++i )
{
if( m_srcState[i] != NULL )
{
src_delete( m_srcState[i] );
}
}
}

View File

@@ -131,9 +131,11 @@ void engine::destroy( void )
presetPreviewPlayHandle::cleanup();
instrumentTrackView::cleanupWindowPool();
delete s_song;
s_song->clearAllTracks();
delete s_bbTrackContainer;
s_bbTrackContainer = NULL;
delete s_dummyTC;
s_dummyTC = NULL;
delete s_mixer;
s_mixer = NULL;
@@ -147,6 +149,9 @@ void engine::destroy( void )
s_projectJournal = NULL;
s_mainWindow = NULL;
delete s_song;
s_song = NULL;
delete configManager::inst();
}

View File

@@ -741,8 +741,8 @@ bool ladspaManager::isInteger( const ladspa_key_t & _plugin,
QString ladspaManager::getPortName( const ladspa_key_t & _plugin,
Uint32 _port )
{
if( m_ladspaManagerMap.contains( _plugin )
&& _port < getPortCount( _plugin ) )
if( m_ladspaManagerMap.contains( _plugin ) &&
_port < getPortCount( _plugin ) )
{
LADSPA_Descriptor_Function descriptorFunction =
m_ladspaManagerMap[_plugin]->descriptorFunction;