From f5615b405912109d63863ac89fd1dbcf564214ab Mon Sep 17 00:00:00 2001 From: sakertooth Date: Fri, 8 Sep 2023 14:07:17 -0400 Subject: [PATCH] Fix heap-use-after-free in Track::loadSettings --- src/core/Track.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/Track.cpp b/src/core/Track.cpp index b034b95fb..f5b67ef1d 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -290,11 +290,7 @@ void Track::loadSettings( const QDomElement & element ) return; } - while( !m_clips.empty() ) - { - delete m_clips.front(); -// m_clips.erase( m_clips.begin() ); - } + deleteClips(); QDomNode node = element.firstChild(); while( !node.isNull() ) @@ -365,6 +361,7 @@ void Track::removeClip( Clip * clip ) /*! \brief Remove all Clips from this track */ void Track::deleteClips() { + auto guard = Engine::audioEngine()->requestChangesGuard(); while (!m_clips.empty()) { delete m_clips.front();