fixes for shared_ptr from this errors in Region, mostly for testing by Sampo (other debugging work is ongoing). oh yes, fix for AudioRegion::apply_filter() too, previously crash bug

git-svn-id: svn://localhost/ardour2/trunk@997 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-10-20 20:16:49 +00:00
parent 3e577fee98
commit 273d9fa8d6
4 changed files with 15 additions and 6 deletions

View file

@ -1071,7 +1071,8 @@ AudioRegion::source_equivalent (boost::shared_ptr<const Region> o) const
int
AudioRegion::apply (AudioFilter& filter)
{
return filter.run (boost::shared_ptr<AudioRegion> (this));
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (shared_from_this());
return filter.run (ar);
}
int

View file

@ -1428,7 +1428,11 @@ Playlist::state (bool full_state)
if (full_state) {
RegionLock rlock (this, false);
cerr << _name << " getting region state for " << regions.size() << endl;
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
cerr << "\t" << " now at " << (*i) << endl;
cerr << "\t\t" << (*i)->name() << endl;
node->add_child_nocopy ((*i)->get_state());
}
}

View file

@ -28,6 +28,7 @@
#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <pbd/stacktrace.h>
#include <ardour/region.h>
#include <ardour/playlist.h>
@ -143,6 +144,8 @@ Region::Region (const XMLNode& node)
Region::~Region ()
{
// cerr << "====== " << _name << " DESTRUCTOR\n";
// stacktrace (cerr);
/* derived classes must call notify_callbacks() and then emit GoingAway */
}
@ -278,7 +281,7 @@ Region::set_position_on_top (nframes_t pos, void *src)
_position = pos;
}
_playlist->raise_region_to_top (boost::shared_ptr<Region>(this));
_playlist->raise_region_to_top (shared_from_this ());
/* do this even if the position is the same. this helps out
a GUI that has moved its representation already.
@ -669,7 +672,7 @@ Region::raise ()
return;
}
_playlist->raise_region (boost::shared_ptr<Region>(this));
_playlist->raise_region (shared_from_this ());
}
void
@ -679,7 +682,7 @@ Region::lower ()
return;
}
_playlist->lower_region (boost::shared_ptr<Region>(this));
_playlist->lower_region (shared_from_this ());
}
void
@ -690,7 +693,7 @@ Region::raise_to_top ()
return;
}
_playlist->raise_region_to_top (boost::shared_ptr<Region>(this));
_playlist->raise_region_to_top (shared_from_this());
}
void
@ -700,7 +703,7 @@ Region::lower_to_bottom ()
return;
}
_playlist->lower_region_to_bottom (boost::shared_ptr<Region>(this));
_playlist->lower_region_to_bottom (shared_from_this());
}
void

View file

@ -469,6 +469,7 @@ Session::~Session ()
tmp = i;
++tmp;
cerr << "dropping refs on an audio region (" << i->second->name() << ") with UC = " << i->second.use_count() << endl;
i->second->drop_references ();
i = tmp;