diff --git a/src/core/Track.cpp b/src/core/Track.cpp index f5b67ef1d..331f0d3d2 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -345,6 +345,7 @@ Clip * Track::addClip( Clip * clip ) */ void Track::removeClip( Clip * clip ) { + auto guard = Engine::audioEngine()->requestChangesGuard(); clipVector::iterator it = std::find( m_clips.begin(), m_clips.end(), clip ); if( it != m_clips.end() ) { @@ -650,4 +651,4 @@ BoolModel *Track::getMutedModel() return &m_mutedModel; } -} // namespace lmms \ No newline at end of file +} // namespace lmms diff --git a/src/gui/clips/ClipView.cpp b/src/gui/clips/ClipView.cpp index 034ad135c..f51a0eaa8 100644 --- a/src/gui/clips/ClipView.cpp +++ b/src/gui/clips/ClipView.cpp @@ -284,7 +284,8 @@ bool ClipView::close() /*! \brief Removes a ClipView from its track view. * * Like the close() method, this asks the track view to remove this - * ClipView. + * ClipView. However, the clip is + * scheduled for later deletion rather than closed immediately. * */ void ClipView::remove() @@ -293,8 +294,15 @@ void ClipView::remove() // delete ourself close(); - auto guard = Engine::audioEngine()->requestChangesGuard(); - delete m_clip; + + // Since the Track would own the clip, we don't delete it + if (m_clip->getTrack()) + { + m_clip->getTrack()->removeClip(m_clip); + return; + } + + m_clip->deleteLater(); }