mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
remove two instances of static/global ScopedConnectionList. one remains worth thinking about for semantics (libs/pbd/controllable.cc:registry_connections)
git-svn-id: svn://localhost/ardour2/branches/3.0@12295 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2fb30ea54d
commit
23f03f995f
3 changed files with 16 additions and 10 deletions
|
|
@ -124,7 +124,7 @@ public:
|
|||
static std::map<std::string, uint32_t> region_name_map;
|
||||
static void update_region_name_map (boost::shared_ptr<Region>);
|
||||
|
||||
static PBD::ScopedConnectionList region_list_connections;
|
||||
static PBD::ScopedConnectionList* region_list_connections;
|
||||
static CompoundAssociations _compound_associations;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ using namespace std;
|
|||
PBD::Signal1<void,boost::shared_ptr<Region> > RegionFactory::CheckNewRegion;
|
||||
Glib::StaticMutex RegionFactory::region_map_lock;
|
||||
RegionFactory::RegionMap RegionFactory::region_map;
|
||||
PBD::ScopedConnectionList RegionFactory::region_list_connections;
|
||||
PBD::ScopedConnectionList* RegionFactory::region_list_connections = 0;
|
||||
Glib::StaticMutex RegionFactory::region_name_map_lock;
|
||||
std::map<std::string, uint32_t> RegionFactory::region_name_map;
|
||||
RegionFactory::CompoundAssociations RegionFactory::_compound_associations;
|
||||
|
|
@ -321,12 +321,12 @@ RegionFactory::map_add (boost::shared_ptr<Region> r)
|
|||
region_map.insert (p);
|
||||
}
|
||||
|
||||
r->DropReferences.connect_same_thread (region_list_connections, boost::bind (&RegionFactory::map_remove, boost::weak_ptr<Region> (r)));
|
||||
if (!region_list_connections) {
|
||||
region_list_connections = new ScopedConnectionList;
|
||||
}
|
||||
|
||||
r->PropertyChanged.connect_same_thread (
|
||||
region_list_connections,
|
||||
boost::bind (&RegionFactory::region_changed, _1, boost::weak_ptr<Region> (r))
|
||||
);
|
||||
r->DropReferences.connect_same_thread (*region_list_connections, boost::bind (&RegionFactory::map_remove, boost::weak_ptr<Region> (r)));
|
||||
r->PropertyChanged.connect_same_thread (*region_list_connections, boost::bind (&RegionFactory::region_changed, _1, boost::weak_ptr<Region> (r)));
|
||||
|
||||
update_region_name_map (r);
|
||||
}
|
||||
|
|
@ -384,7 +384,9 @@ RegionFactory::region_by_name (const std::string& name)
|
|||
void
|
||||
RegionFactory::clear_map ()
|
||||
{
|
||||
region_list_connections.drop_connections ();
|
||||
if (region_list_connections) {
|
||||
region_list_connections->drop_connections ();
|
||||
}
|
||||
|
||||
{
|
||||
Glib::Mutex::Lock lm (region_map_lock);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ PBD::Signal1<void,Controllable*> Controllable::DeleteBinding;
|
|||
|
||||
Glib::StaticRWLock Controllable::registry_lock = GLIBMM_STATIC_RW_LOCK_INIT;
|
||||
Controllable::Controllables Controllable::registry;
|
||||
PBD::ScopedConnectionList registry_connections;
|
||||
PBD::ScopedConnectionList* registry_connections = 0;
|
||||
const std::string Controllable::xml_node_name = X_("Controllable");
|
||||
|
||||
Controllable::Controllable (const string& name, Flag f)
|
||||
|
|
@ -55,9 +55,13 @@ Controllable::add (Controllable& ctl)
|
|||
Glib::RWLock::WriterLock lm (registry_lock);
|
||||
registry.insert (&ctl);
|
||||
|
||||
if (!registry_connections) {
|
||||
registry_connections = new ScopedConnectionList;
|
||||
}
|
||||
|
||||
/* Controllable::remove() is static - no need to manage this connection */
|
||||
|
||||
ctl.DropReferences.connect_same_thread (registry_connections, boost::bind (&Controllable::remove, &ctl));
|
||||
ctl.DropReferences.connect_same_thread (*registry_connections, boost::bind (&Controllable::remove, &ctl));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue