From 27cf4b989cc1d03ecb8c3629aeb9f592a6b3ea9f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 19 Dec 2006 16:21:24 +0000 Subject: [PATCH] potential fix for crashing bug caused by mutex lifetime in ~AudioDiskstream git-svn-id: svn://localhost/ardour2/trunk@1231 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_diskstream.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index e30c683d8e..e3b4c2b61b 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -168,12 +168,18 @@ AudioDiskstream::destroy_channel (ChannelInfo &chan) AudioDiskstream::~AudioDiskstream () { - Glib::Mutex::Lock lm (state_lock); + { + /* don't be holding this lock as we exit the destructor, glib will wince + visibly since the mutex gets destroyed before we release it. + */ - for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) - destroy_channel((*chan)); - - channels.clear(); + Glib::Mutex::Lock lm (state_lock); + + for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) + destroy_channel((*chan)); + + channels.clear(); + } } void