clean up editor mixer strip when session is going away; slightly improved boost debugging
git-svn-id: svn://localhost/ardour2/branches/3.0@6397 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
defa1fad94
commit
f53cbaede8
@ -355,6 +355,20 @@ Editor::session_going_away ()
|
||||
_routes->clear ();
|
||||
_route_groups->clear ();
|
||||
|
||||
/* do this first so that deleting a track doesn't reset cms to null
|
||||
and thus cause a leak.
|
||||
*/
|
||||
|
||||
if (current_mixer_strip) {
|
||||
if (current_mixer_strip->get_parent() != 0) {
|
||||
global_hpacker.remove (*current_mixer_strip);
|
||||
}
|
||||
delete current_mixer_strip;
|
||||
current_mixer_strip = 0;
|
||||
}
|
||||
|
||||
/* delete all trackviews */
|
||||
|
||||
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
@ -376,14 +390,6 @@ Editor::session_going_away ()
|
||||
|
||||
/* get rid of any existing editor mixer strip */
|
||||
|
||||
if (current_mixer_strip) {
|
||||
if (current_mixer_strip->get_parent() != 0) {
|
||||
global_hpacker.remove (*current_mixer_strip);
|
||||
}
|
||||
delete current_mixer_strip;
|
||||
current_mixer_strip = 0;
|
||||
}
|
||||
|
||||
WindowTitle title(Glib::get_application_name());
|
||||
title += _("Editor");
|
||||
|
||||
|
@ -502,6 +502,7 @@ Mixer_UI::session_going_away ()
|
||||
for (list<MixerStrip *>::iterator i = strips.begin(); i != strips.end(); ++i) {
|
||||
delete (*i);
|
||||
}
|
||||
strips.clear ();
|
||||
|
||||
WindowTitle title(Glib::get_application_name());
|
||||
title += _("Mixer");
|
||||
|
@ -29,7 +29,7 @@ class SessionHandleRef : public PBD::ScopedConnectionList
|
||||
{
|
||||
public:
|
||||
SessionHandleRef (ARDOUR::Session& s);
|
||||
virtual ~SessionHandleRef () {}
|
||||
virtual ~SessionHandleRef ();
|
||||
|
||||
protected:
|
||||
ARDOUR::Session& _session;
|
||||
|
@ -46,7 +46,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, nframes_t start,
|
||||
|
||||
if ((other_a = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
|
||||
AudioRegion* ar = new AudioRegion (other_a, start, length, name, layer, flags);
|
||||
boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
|
||||
boost_debug_shared_ptr_mark_interesting (ar, "Region");
|
||||
boost::shared_ptr<AudioRegion> arp (ar);
|
||||
boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp));
|
||||
ret->unlock_property_changes ();
|
||||
@ -79,7 +79,7 @@ RegionFactory::create (boost::shared_ptr<const Region> region)
|
||||
|
||||
if ((ar = boost::dynamic_pointer_cast<const AudioRegion>(region)) != 0) {
|
||||
AudioRegion* arn = new AudioRegion (ar);
|
||||
boost_debug_shared_ptr_mark_interesting (arn, typeid (arn).name());
|
||||
boost_debug_shared_ptr_mark_interesting (arn, "Region");
|
||||
boost::shared_ptr<Region> ret (arn);
|
||||
ret->unlock_property_changes ();
|
||||
/* pure copy constructor - no CheckNewRegion emitted */
|
||||
@ -118,7 +118,7 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
|
||||
|
||||
if ((other = boost::dynamic_pointer_cast<AudioRegion>(region)) != 0) {
|
||||
AudioRegion* ar = new AudioRegion (other, srcs, srcs.front()->length(srcs.front()->timeline_position()), name, layer, flags);
|
||||
boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
|
||||
boost_debug_shared_ptr_mark_interesting (ar, "Region");
|
||||
boost::shared_ptr<AudioRegion> arp (ar);
|
||||
boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp));
|
||||
ret->unlock_property_changes ();
|
||||
@ -157,7 +157,7 @@ RegionFactory::create (const SourceList& srcs, nframes_t start, nframes_t length
|
||||
if (srcs[0]->type() == DataType::AUDIO) {
|
||||
|
||||
AudioRegion* ar = new AudioRegion (srcs, start, length, name, layer, flags);
|
||||
boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
|
||||
boost_debug_shared_ptr_mark_interesting (ar, "Region");
|
||||
boost::shared_ptr<AudioRegion> arp (ar);
|
||||
boost::shared_ptr<Region> ret (boost::static_pointer_cast<Region> (arp));
|
||||
ret->unlock_property_changes ();
|
||||
@ -191,7 +191,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
|
||||
|
||||
if (srcs[0]->type() == DataType::AUDIO) {
|
||||
AudioRegion* ar = new AudioRegion (srcs, node);
|
||||
boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
|
||||
boost_debug_shared_ptr_mark_interesting (ar, "Region");
|
||||
boost::shared_ptr<Region> ret (ar);
|
||||
ret->unlock_property_changes ();
|
||||
CheckNewRegion (ret);
|
||||
@ -214,7 +214,7 @@ RegionFactory::create (boost::shared_ptr<Source> src, nframes_t start, nframes_t
|
||||
|
||||
if ((as = boost::dynamic_pointer_cast<AudioSource>(src)) != 0) {
|
||||
AudioRegion* ar = new AudioRegion (as, start, length, name, layer, flags);
|
||||
boost_debug_shared_ptr_mark_interesting (ar, typeid (ar).name());
|
||||
boost_debug_shared_ptr_mark_interesting (ar, "Region");
|
||||
boost::shared_ptr<Region> ret (ar);
|
||||
ret->unlock_property_changes ();
|
||||
if (announce) {
|
||||
|
@ -280,8 +280,8 @@ Session::Session (AudioEngine &eng,
|
||||
if (master_out_channels) {
|
||||
ChanCount count(DataType::AUDIO, master_out_channels);
|
||||
Route* rt = new Route (*this, _("master"), Route::MasterOut, DataType::AUDIO);
|
||||
boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
|
||||
shared_ptr<Route> r (rt);
|
||||
boost_debug_shared_ptr_mark_interesting (rt, "Route");
|
||||
boost::shared_ptr<Route> r (rt);
|
||||
r->input()->ensure_io (count, false, this);
|
||||
r->output()->ensure_io (count, false, this);
|
||||
r->set_remote_control_id (control_id);
|
||||
@ -295,7 +295,7 @@ Session::Session (AudioEngine &eng,
|
||||
if (control_out_channels) {
|
||||
ChanCount count(DataType::AUDIO, control_out_channels);
|
||||
Route* rt = new Route (*this, _("monitor"), Route::ControlOut, DataType::AUDIO);
|
||||
boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
|
||||
boost_debug_shared_ptr_mark_interesting (rt, "Route");
|
||||
shared_ptr<Route> r (rt);
|
||||
r->input()->ensure_io (count, false, this);
|
||||
r->output()->ensure_io (count, false, this);
|
||||
@ -363,7 +363,8 @@ Session::destroy ()
|
||||
Stateful::loading_state_version = 0;
|
||||
|
||||
_butler->terminate_thread ();
|
||||
|
||||
delete _butler;
|
||||
|
||||
delete midi_control_ui;
|
||||
|
||||
if (click_data != default_click) {
|
||||
@ -424,6 +425,8 @@ Session::destroy ()
|
||||
/* writer goes out of scope and updates master */
|
||||
}
|
||||
routes.flush ();
|
||||
extern void boost_debug_count_ptrs ();
|
||||
boost_debug_count_ptrs ();
|
||||
|
||||
DEBUG_TRACE (DEBUG::Destruction, "delete diskstreams\n");
|
||||
{
|
||||
@ -1739,7 +1742,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
|
||||
|
||||
try {
|
||||
AudioTrack* at = new AudioTrack (*this, track_name, Route::Flag (0), mode);
|
||||
boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
|
||||
boost_debug_shared_ptr_mark_interesting (at, "Track");
|
||||
track = boost::shared_ptr<AudioTrack>(at);
|
||||
|
||||
if (track->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
|
||||
@ -1930,7 +1933,7 @@ Session::new_audio_route (bool aux, int input_channels, int output_channels, Rou
|
||||
|
||||
try {
|
||||
Route* rt = new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO);
|
||||
boost_debug_shared_ptr_mark_interesting (rt, typeid (rt).name());
|
||||
boost_debug_shared_ptr_mark_interesting (rt, "Route");
|
||||
shared_ptr<Route> bus (rt);
|
||||
|
||||
if (bus->input()->ensure_io (ChanCount(DataType::AUDIO, input_channels), false, this)) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/boost_debug.h"
|
||||
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/session_handle.h"
|
||||
@ -67,6 +68,10 @@ SessionHandleRef::SessionHandleRef (Session& s)
|
||||
_session.Destroyed.connect_same_thread (*this, boost::bind (&SessionHandleRef::insanity_check, this));
|
||||
}
|
||||
|
||||
SessionHandleRef::~SessionHandleRef ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SessionHandleRef::session_going_away ()
|
||||
{
|
||||
|
@ -1388,16 +1388,17 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
|
||||
if (has_diskstream) {
|
||||
if (type == DataType::AUDIO) {
|
||||
AudioTrack* at = new AudioTrack (*this, node, version);
|
||||
// boost_debug_shared_ptr_mark_interesting (at, typeid (at).name());
|
||||
boost::shared_ptr<Route> ret (at);
|
||||
return ret;
|
||||
boost_debug_shared_ptr_mark_interesting (at, "Track");
|
||||
return boost::shared_ptr<Route> (at);
|
||||
|
||||
} else {
|
||||
boost::shared_ptr<Route> ret (new MidiTrack (*this, node, version));
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
boost::shared_ptr<Route> ret (new Route (*this, node));
|
||||
return ret;
|
||||
Route* rt = new Route (*this, node);
|
||||
boost_debug_shared_ptr_mark_interesting (rt, "Route");
|
||||
return boost::shared_ptr<Route> (rt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ boost::shared_ptr<Source>
|
||||
SourceFactory::createSilent (Session& s, const XMLNode& node, nframes_t nframes, float sr)
|
||||
{
|
||||
Source* src = new SilentFileSource (s, node, nframes, sr);
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
// no analysis data - the file is non-existent
|
||||
SourceCreated (ret);
|
||||
@ -146,7 +146,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||
try {
|
||||
|
||||
Source* src = new SndFileSource (s, node);
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
if (setup_peakfile (ret, defer_peaks)) {
|
||||
return boost::shared_ptr<Source>();
|
||||
@ -163,7 +163,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||
/* this is allowed to throw */
|
||||
|
||||
Source *src = new CoreAudioSource (s, node);
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
|
||||
if (setup_peakfile (ret, defer_peaks)) {
|
||||
@ -180,7 +180,7 @@ SourceFactory::create (Session& s, const XMLNode& node, bool defer_peaks)
|
||||
|
||||
} else if (type == DataType::MIDI) {
|
||||
Source* src = new SMFSource (s, node);
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
ret->check_for_analysis_data_on_disk ();
|
||||
SourceCreated (ret);
|
||||
@ -201,7 +201,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path,
|
||||
try {
|
||||
|
||||
Source* src = new SndFileSource (s, path, chn, flags);
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
|
||||
if (setup_peakfile (ret, defer_peaks)) {
|
||||
@ -219,7 +219,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path,
|
||||
#ifdef USE_COREAUDIO_FOR_FILES
|
||||
|
||||
Source* src = new CoreAudioSource (s, path, chn, flags);
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
if (setup_peakfile (ret, defer_peaks)) {
|
||||
return boost::shared_ptr<Source>();
|
||||
@ -242,7 +242,7 @@ SourceFactory::createReadable (DataType type, Session& s, const string& path,
|
||||
} else if (type == DataType::MIDI) {
|
||||
|
||||
Source* src = new SMFSource (s, path, SMFSource::Flag(0));
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
|
||||
if (announce) {
|
||||
@ -270,7 +270,7 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
|
||||
(destructive
|
||||
? Source::Flag (SndFileSource::default_writable_flags | Source::Destructive)
|
||||
: SndFileSource::default_writable_flags));
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
|
||||
if (setup_peakfile (ret, defer_peaks)) {
|
||||
@ -287,7 +287,7 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
|
||||
} else if (type == DataType::MIDI) {
|
||||
|
||||
Source* src = new SMFSource (s, path, Source::Flag(0));
|
||||
// boost_debug_shared_ptr_mark_interesting (src, typeid(src).name());
|
||||
// boost_debug_shared_ptr_mark_interesting (src, "Source");
|
||||
boost::shared_ptr<Source> ret (src);
|
||||
|
||||
// no analysis data - this is a new file
|
||||
|
@ -146,18 +146,51 @@ boost_debug_shared_ptr_mark_interesting (void* ptr, const char* type)
|
||||
}
|
||||
|
||||
void
|
||||
boost_debug_shared_ptr_operator_equals (void const *sp, void const *obj, int)
|
||||
boost_debug_shared_ptr_operator_equals (void const *sp, void const *old_obj, int old_use_count, void const *obj, int new_use_count)
|
||||
{
|
||||
if (is_interesting_object (obj)) {
|
||||
cerr << "sp @ " << sp << " assigned\n";
|
||||
if (old_obj == 0 && obj == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Glib::Mutex::Lock guard (the_lock);
|
||||
|
||||
if (is_interesting_object (old_obj) || is_interesting_object (obj)) {
|
||||
// cerr << "ASSIGN SWAPS " << old_obj << " & " << obj << endl;
|
||||
}
|
||||
|
||||
if (is_interesting_object (old_obj)) {
|
||||
// cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count
|
||||
// << " (total sp's = " << sptrs.size() << ')' << endl;
|
||||
|
||||
PointerMap::iterator x = sptrs.find (sp);
|
||||
|
||||
if (x != sptrs.end()) {
|
||||
sptrs.erase (x);
|
||||
// cerr << "\tRemoved (by assigment) sp for " << old_obj << " @ " << sp << " UC = " << old_use_count << " (total sp's = " << sptrs.size() << ')' << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_interesting_object (obj)) {
|
||||
|
||||
pair<void const*, SPDebug*> newpair;
|
||||
|
||||
newpair.first = sp;
|
||||
newpair.second = new SPDebug (new Backtrace());
|
||||
|
||||
sptrs.insert (newpair);
|
||||
|
||||
// cerr << "assignment created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count
|
||||
// << " UC = " << new_use_count
|
||||
// << " (total sp's = " << sptrs.size() << ')' << endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
boost_debug_shared_ptr_reset (void const *sp, void const *obj, int)
|
||||
boost_debug_shared_ptr_reset (void const *sp, void const *obj, int use_count)
|
||||
{
|
||||
if (is_interesting_object (obj)) {
|
||||
cerr << "sp @ " << sp << " reset\n";
|
||||
// cerr << "reset sp to object @ " << obj << " @ " << sp << " UC was " << use_count << " (total sp's = " << sptrs.size() << ')' << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +202,7 @@ boost_debug_shared_ptr_destructor (void const *sp, void const *obj, int use_coun
|
||||
|
||||
if (x != sptrs.end()) {
|
||||
sptrs.erase (x);
|
||||
// cerr << "Removed sp for " << obj << " @ " << sp << endl;
|
||||
// cerr << "Removed sp for " << obj << " @ " << sp << " UC = " << use_count << " (total sp's = " << sptrs.size() << ')' << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,10 +217,17 @@ boost_debug_shared_ptr_constructor (void const *sp, void const *obj, int use_cou
|
||||
newpair.second = new SPDebug (new Backtrace());
|
||||
|
||||
sptrs.insert (newpair);
|
||||
// cerr << "Stored constructor for " << obj << " @ " << sp << endl;
|
||||
// cerr << "Stored constructor for " << obj << " @ " << sp << " UC = " << use_count << " (total sp's = " << sptrs.size() << ')' << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
boost_debug_count_ptrs ()
|
||||
{
|
||||
Glib::Mutex::Lock guard (the_lock);
|
||||
// cerr << "Tracking " << interesting_pointers.size() << " interesting objects with " << sptrs.size () << " shared ptrs\n";
|
||||
}
|
||||
|
||||
void
|
||||
boost_debug_list_ptrs ()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user