mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
RTA: fix potential invalidated iterator when clearing RTA
This commit is contained in:
parent
460377bec0
commit
6ff013346a
2 changed files with 8 additions and 1 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include "gtk2ardour-config.h"
|
||||
#endif
|
||||
|
||||
#include "pbd/unwind.h"
|
||||
#include "pbd/types_convert.h"
|
||||
|
||||
#include "ardour/rt_safe_delete.h"
|
||||
|
|
@ -49,6 +50,7 @@ RTAManager::RTAManager ()
|
|||
: _active (false)
|
||||
, _speed (ARDOUR::DSP::PerceptualAnalyzer::Moderate)
|
||||
, _warp (ARDOUR::DSP::PerceptualAnalyzer::Medium)
|
||||
, _clearing (false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -187,6 +189,9 @@ RTAManager::attach (std::shared_ptr<ARDOUR::Route> route)
|
|||
void
|
||||
RTAManager::remove (std::shared_ptr<ARDOUR::Route> route)
|
||||
{
|
||||
if (_clearing) {
|
||||
return;
|
||||
}
|
||||
_rta.remove_if ([route] (RTAManager::RTA const& r) { return r.route () == route; });
|
||||
route->gui_changed ("rta", this); /* EMIT SIGNAL */
|
||||
|
||||
|
|
@ -198,6 +203,8 @@ RTAManager::remove (std::shared_ptr<ARDOUR::Route> route)
|
|||
void
|
||||
RTAManager::clear ()
|
||||
{
|
||||
PBD::Unwinder<bool> uw (_clearing, true);
|
||||
|
||||
std::list<RTA>::iterator i = _rta.begin ();
|
||||
while (i != _rta.end ()) {
|
||||
std::shared_ptr<ARDOUR::Route> route = i->route ();
|
||||
|
|
|
|||
|
|
@ -120,6 +120,6 @@ private:
|
|||
bool _active;
|
||||
ARDOUR::DSP::PerceptualAnalyzer::Speed _speed;
|
||||
ARDOUR::DSP::PerceptualAnalyzer::Warp _warp;
|
||||
|
||||
bool _clearing;
|
||||
sigc::connection _update_connection;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue