From 20db119cd3086c32e7e7e8efe12ace4ce1e2dadf Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 23 Oct 2007 12:50:25 +0000 Subject: [PATCH] Fix crash due to invalidated shared_ptr, as suggested by Paul git-svn-id: svn://localhost/ardour2/trunk@2565 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_playlist.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index d5c6120946..f4c10cbc12 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -271,11 +271,12 @@ AudioPlaylist::refresh_dependents (boost::shared_ptr r) if ((*x)->involves (ar)) { - if (find (updated.begin(), updated.end(), *x) == updated.end()) { - try { - if ((*x)->refresh ()) { - updated.insert (*x); - } + pair >::iterator, bool> const u = updated.insert (*x); + + if (u.second) { + /* x was successfully inserted into the set, so it has not already been updated */ + try { + (*x)->refresh (); } catch (Crossfade::NoCrossfadeHere& err) {