From a4f3d5d26761c44f2d0c98fea3015c55471d947e Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 14 Mar 2008 11:30:46 +0000 Subject: [PATCH] fixed segfault when using raw MIDI-client git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@788 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 5 ++++ src/widgets/instrument_midi_io_view.cpp | 32 +++++++++++++++---------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f118bfe43..7ecf020a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-14 Tobias Doerffel + + * src/widgets/instrument_midi_io_view.cpp: + fixed segfault when using raw MIDI-client + 2008-03-08 Tobias Doerffel * data/locale/de.ts: diff --git a/src/widgets/instrument_midi_io_view.cpp b/src/widgets/instrument_midi_io_view.cpp index db44475c6..f819bc953 100644 --- a/src/widgets/instrument_midi_io_view.cpp +++ b/src/widgets/instrument_midi_io_view.cpp @@ -206,14 +206,17 @@ void instrumentMidiIOView::activatedWriteablePort( QAction * _item ) void instrumentMidiIOView::updateReadablePortsMenu( void ) { instrumentMidiIO * mio = castModel(); - m_readablePorts->clear(); - for( instrumentMidiIO::midiPortMap::const_iterator it = + if( m_readablePorts ) + { + m_readablePorts->clear(); + for( instrumentMidiIO::midiPortMap::const_iterator it = mio->m_readablePorts.begin(); it != mio->m_readablePorts.end(); ++it ) - { - QAction * a = m_readablePorts->addAction( it->first ); - a->setCheckable( TRUE ); - a->setChecked( it->second ); + { + QAction * a = m_readablePorts->addAction( it->first ); + a->setCheckable( TRUE ); + a->setChecked( it->second ); + } } } @@ -223,14 +226,17 @@ void instrumentMidiIOView::updateReadablePortsMenu( void ) void instrumentMidiIOView::updateWriteablePortsMenu( void ) { instrumentMidiIO * mio = castModel(); - m_writeablePorts->clear(); - for( instrumentMidiIO::midiPortMap::const_iterator it = - mio->m_writeablePorts.begin(); - it != mio->m_writeablePorts.end(); ++it ) + if( m_writeablePorts ) { - QAction * a = m_writeablePorts->addAction( it->first ); - a->setCheckable( TRUE ); - a->setChecked( it->second ); + m_writeablePorts->clear(); + for( instrumentMidiIO::midiPortMap::const_iterator it = + mio->m_writeablePorts.begin(); + it != mio->m_writeablePorts.end(); ++it ) + { + QAction * a = m_writeablePorts->addAction( it->first ); + a->setCheckable( TRUE ); + a->setChecked( it->second ); + } } }