fixed various crashes when removing instrument-track with visible instrument-track-window or loading another instrument/preset

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@712 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-02-25 21:27:58 +00:00
parent fec4e7f5f9
commit a5010428f8
8 changed files with 41 additions and 8 deletions

View File

@@ -139,6 +139,7 @@ instrumentView::instrumentView( instrument * _instrument, QWidget * _parent ) :
{
setModel( _instrument );
setFixedSize( 250, 250 );
setAttribute( Qt::WA_DeleteOnClose, TRUE );
}
@@ -146,24 +147,34 @@ instrumentView::instrumentView( instrument * _instrument, QWidget * _parent ) :
instrumentView::~instrumentView()
{
if( getInstrumentTrackWindow() )
{
getInstrumentTrackWindow()->m_instrumentView = NULL;
}
}
void instrumentView::setModel( ::model * _model, bool )
{
if( dynamic_cast<instrument *>( _model ) != NULL )
{
modelView::setModel( _model );
if( dynamic_cast<instrumentTrackView *>( parentWidget() ) !=
NULL )
{
dynamic_cast<instrumentTrackView *>( parentWidget() )->
setWindowIcon( *( model()->
getInstrumentTrackWindow()->setWindowIcon( *( model()->
getDescriptor()->logo ) );
}
connect( model(), SIGNAL( destroyed( QObject * ) ),
this, SLOT( close() ) );
}
}
instrumentTrackWindow * instrumentView::getInstrumentTrackWindow( void )
{
return( dynamic_cast<instrumentTrackWindow *>(
parentWidget()->parentWidget() ) );
}
#endif

View File

@@ -145,6 +145,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
instrumentTrack::~instrumentTrack()
{
delete m_instrument;
engine::getMixer()->removePlayHandles( this );
engine::getMixer()->getMIDIClient()->removePort( m_midiPort );
}
@@ -778,6 +779,7 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
m_instrument->restoreState(
node.toElement() );
}
emit instrumentChanged();
}
}
node = node.nextSibling();
@@ -1146,6 +1148,7 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
instrumentTrackWindow::~instrumentTrackWindow()
{
delete m_instrumentView;
if( engine::getMainWindow()->workspace() )
{
parentWidget()->hide();
@@ -1167,6 +1170,7 @@ void instrumentTrackWindow::modelChanged( void )
this, SLOT( updateInstrumentView() ),
Qt::QueuedConnection );
m_volumeKnob->setModel( &m_track->m_volumeModel );
m_volumeKnob->setModel( &m_track->m_volumeModel );
m_surroundArea->setModel( &m_track->m_surroundAreaModel );
m_pianoView->setModel( &m_track->m_piano );

View File

@@ -207,8 +207,6 @@ void automatableButtonGroup::removeButton( automatableButton * _btn )
{
m_buttons.erase( qFind( m_buttons.begin(), m_buttons.end(), _btn ) );
_btn->m_group = NULL;
model()->setRange( 0, m_buttons.size() - 1 );
}
@@ -243,6 +241,7 @@ void automatableButtonGroup::modelChanged( void )
void automatableButtonGroup::updateButtons( void )
{
model()->setRange( 0, m_buttons.size() - 1 );
int i = 0;
foreach( automatableButton * btn, m_buttons )
{

View File

@@ -77,6 +77,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
groupBox::~groupBox()
{
delete m_led;
}

View File

@@ -88,6 +88,7 @@ chordCreatorView::chordCreatorView( chordCreator * _cc, QWidget * _parent ) :
chordCreatorView::~chordCreatorView()
{
delete m_chordsGroupBox;
}
@@ -231,6 +232,8 @@ arpeggiatorView::arpeggiatorView( arpeggiator * _arp, QWidget * _parent ) :
arpeggiatorView::~arpeggiatorView()
{
delete m_arpDirectionBtnGrp;
delete m_arpGroupBox;
}