diff options
author | Carl Hetherington <carl@carlh.net> | 2012-01-04 13:56:09 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-01-04 13:56:09 +0000 |
commit | b9a9d8d0471c28e80e350d6e49cde965f87b986b (patch) | |
tree | 2ee216de7cc2b400e9dd2aabaaa5d451e1f33141 /libs/ardour/playlist.cc | |
parent | 365a8f7f14bdc653bb012b10be8938a8eaaa69ce (diff) |
Use a few shared_ptrs to make things slightly neater.
git-svn-id: svn://localhost/ardour2/branches/3.0@11156 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r-- | libs/ardour/playlist.cc | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index bcc203694e..bc11b863eb 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1634,13 +1634,12 @@ Playlist::flush_notifications (bool from_undo) FINDING THINGS **********************************************************************/ - Playlist::RegionList * - Playlist::regions_at (framepos_t frame) - - { - RegionLock rlock (this); - return find_regions_at (frame); - } +boost::shared_ptr<Playlist::RegionList> +Playlist::regions_at (framepos_t frame) +{ + RegionLock rlock (this); + return find_regions_at (frame); +} uint32_t Playlist::count_regions_at (framepos_t frame) const @@ -1662,7 +1661,7 @@ Playlist::flush_notifications (bool from_undo) { RegionLock rlock (this); - RegionList *rlist = find_regions_at (frame); + boost::shared_ptr<RegionList> rlist = find_regions_at (frame); boost::shared_ptr<Region> region; if (rlist->size()) { @@ -1671,7 +1670,6 @@ Playlist::flush_notifications (bool from_undo) region = rlist->back(); } - delete rlist; return region; } @@ -1680,7 +1678,7 @@ Playlist::flush_notifications (bool from_undo) { RegionLock rlock (this); - RegionList *rlist = find_regions_at (frame); + boost::shared_ptr<RegionList> rlist = find_regions_at (frame); for (RegionList::iterator i = rlist->begin(); i != rlist->end(); ) { @@ -1702,13 +1700,12 @@ Playlist::flush_notifications (bool from_undo) region = rlist->back(); } - delete rlist; return region; } - Playlist::RegionList* - Playlist::regions_to_read (framepos_t start, framepos_t end) - { +boost::shared_ptr<Playlist::RegionList> +Playlist::regions_to_read (framepos_t start, framepos_t end) +{ /* Caller must hold lock */ RegionList covering; @@ -1772,7 +1769,7 @@ Playlist::flush_notifications (bool from_undo) } } - RegionList* rlist = new RegionList; + boost::shared_ptr<RegionList> rlist (new RegionList); /* find all the regions that cover each position .... */ @@ -1841,36 +1838,36 @@ Playlist::flush_notifications (bool from_undo) return rlist; } - Playlist::RegionList * - Playlist::find_regions_at (framepos_t frame) - { - /* Caller must hold lock */ - - RegionList *rlist = new RegionList; - - for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { - if ((*i)->covers (frame)) { - rlist->push_back (*i); - } - } - - return rlist; - } - - Playlist::RegionList * - Playlist::regions_touched (framepos_t start, framepos_t end) - { - RegionLock rlock (this); - RegionList *rlist = new RegionList; +boost::shared_ptr<Playlist::RegionList> +Playlist::find_regions_at (framepos_t frame) +{ + /* Caller must hold lock */ + + boost::shared_ptr<RegionList> rlist (new RegionList); - for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { - if ((*i)->coverage (start, end) != OverlapNone) { - rlist->push_back (*i); - } - } + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + if ((*i)->covers (frame)) { + rlist->push_back (*i); + } + } + + return rlist; +} +boost::shared_ptr<Playlist::RegionList> +Playlist::regions_touched (framepos_t start, framepos_t end) +{ + RegionLock rlock (this); + boost::shared_ptr<RegionList> rlist (new RegionList); + + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + if ((*i)->coverage (start, end) != OverlapNone) { + rlist->push_back (*i); + } + } + return rlist; - } +} framepos_t Playlist::find_next_transient (framepos_t from, int dir) |