From 67d2cb50843c73024758d6f73c35bae37070b67b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 6 Jun 2011 18:05:47 +0000 Subject: Use a care pointer reference to containing module rather than boost::weak_ptr. git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3364 a436a847-0d15-0410-975c-d299462d15a1 --- src/AlsaDriver.cpp | 4 ++-- src/JackDriver.cpp | 6 +++--- src/Patchage.cpp | 6 +++--- src/Patchage.hpp | 4 ++-- src/PatchageCanvas.cpp | 4 ++-- src/PatchageEvent.cpp | 2 +- src/PatchagePort.hpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index 56bef22..5ab24bb 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -117,7 +117,7 @@ AlsaDriver::find_or_create_module( m = boost::shared_ptr(new PatchageModule(patchage, client_name, type)); m->load_location(); _app->canvas()->add_module(client_name, m); - _app->enqueue_resize(m); + _app->enqueue_resize(m.get()); } return m; } @@ -294,7 +294,7 @@ AlsaDriver::refresh_ports() if (!ignore(addr)) { create_port_view_internal(_app, addr, parent, port); if (parent) - _app->enqueue_resize(parent); + _app->enqueue_resize(parent.get()); } } } diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 5b2d180..79ff93b 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -131,7 +131,7 @@ JackDriver::destroy_all() if (module->ports().empty()) _app->canvas()->remove_item(module); else - _app->enqueue_resize(module); + _app->enqueue_resize(module.get()); } } @@ -187,7 +187,7 @@ JackDriver::create_port_view(Patchage* patchage, } if (resize) - _app->enqueue_resize(parent); + _app->enqueue_resize(parent.get()); return port; } @@ -298,7 +298,7 @@ JackDriver::refresh() if (!m->get_port(jack_port_short_name(port))) m->add_port(create_port(m, port, PortID())); - _app->enqueue_resize(m); + _app->enqueue_resize(m.get()); } // Add all connections diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 0cf5cc7..9682971 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -812,7 +812,7 @@ Patchage::on_scroll(GdkEventScroll* ev) } void -Patchage::enqueue_resize(boost::shared_ptr module) +Patchage::enqueue_resize(FlowCanvas::Module* module) { if (module) _pending_resize.insert(module); @@ -821,8 +821,8 @@ Patchage::enqueue_resize(boost::shared_ptr module) void Patchage::flush_resize() { - for (std::set< boost::shared_ptr >::iterator i = _pending_resize.begin(); - i != _pending_resize.end(); ++i) { + for (std::set::iterator i = _pending_resize.begin(); + i != _pending_resize.end(); ++i) { (*i)->resize(); } diff --git a/src/Patchage.hpp b/src/Patchage.hpp index 048c1e4..69d44de 100644 --- a/src/Patchage.hpp +++ b/src/Patchage.hpp @@ -85,7 +85,7 @@ public: void update_state(); void store_window_location(); - void enqueue_resize(boost::shared_ptr module); + void enqueue_resize(FlowCanvas::Module* module); void flush_resize(); protected: @@ -139,7 +139,7 @@ protected: boost::shared_ptr _canvas; - std::set< boost::shared_ptr > _pending_resize; + std::set _pending_resize; JackDriver* _jack_driver; StateManager* _state_manager; diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index 273896b..a26e75d 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -69,7 +69,7 @@ PatchageCanvas::find_port(const PortID& id) PortIndex::iterator i = _port_index.find(id); if (i != _port_index.end()) { - assert(i->second->module().lock()); + assert(i->second->module()); return i->second; } @@ -107,7 +107,7 @@ PatchageCanvas::remove_port(const PortID& id) _port_index.erase(id); - SharedPtr module = PtrCast(port->module().lock()); + PatchageModule* module = dynamic_cast(port->module()); if (!module) return port; diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index 8a51119..e77de3f 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -74,7 +74,7 @@ PatchageEvent::execute(Patchage* patchage) if (driver) { SharedPtr port = driver->create_port_view(patchage, _port_1); if (port) - patchage->enqueue_resize(port->module().lock()); + patchage->enqueue_resize(port->module()); else Raul::error << "Unable to create port view: " << _port_1 << endl; } else { diff --git a/src/PatchagePort.hpp b/src/PatchagePort.hpp index 49f0b57..8e4c188 100644 --- a/src/PatchagePort.hpp +++ b/src/PatchagePort.hpp @@ -62,7 +62,7 @@ public: #endif /** Returns the full name of this port, as "modulename:portname" */ - std::string full_name() const { return _module.lock()->name() + ":" + _name; } + std::string full_name() const { return _module->name() + ":" + _name; } PortType type() const { return _type; } -- cgit v1.2.1