From df6a874147e6bbcc282929c2899f394fab02c822 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 5 Jul 2008 23:25:13 +0000 Subject: [PATCH] * instantly exit noteOff() if already released * manually unlink references to itself in instrumentTrack (fixes segfaults in various situations) git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1278 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/note_play_handle.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index 51235f0a8..1f023f896 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -116,10 +116,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it, notePlayHandle::~notePlayHandle() { - if( m_released == FALSE ) - { - noteOff( 0 ); - } + noteOff( 0 ); if( m_baseNote ) { @@ -127,6 +124,11 @@ notePlayHandle::~notePlayHandle() m_instrumentTrack->m_processHandles.removeAll( this ); } + if( m_instrumentTrack->m_notes[key()] == this ) + { + m_instrumentTrack->m_notes[key()] = NULL; + } + if( m_pluginData != NULL ) { m_instrumentTrack->deleteNotePluginData( this ); @@ -287,6 +289,11 @@ bool notePlayHandle::isFromTrack( const track * _track ) const void notePlayHandle::noteOff( const f_cnt_t _s ) { + if( m_released ) + { + return; + } + // first note-off all sub-notes for( notePlayHandleVector::iterator it = m_subNotes.begin(); it != m_subNotes.end(); ++it )