summaryrefslogtreecommitdiff
path: root/libs/ardour/port.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-01-19 18:58:50 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-01-19 18:58:50 +0000
commit3c1e12e7ac2a1cde32e94ca22a656f32bdf5021a (patch)
treeaa55ffc924a082e1a155662e1122bf33145fb417 /libs/ardour/port.cc
parent5f13eb411ee69b4a810de4a7258c39384e5e1d4f (diff)
check that we're still connected to JACK when using jack_port_get_connections()
git-svn-id: svn://localhost/ardour2/branches/3.0@8543 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/port.cc')
-rw-r--r--libs/ardour/port.cc28
1 files changed, 19 insertions, 9 deletions
diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc
index fe234c593f..2a89560b77 100644
--- a/libs/ardour/port.cc
+++ b/libs/ardour/port.cc
@@ -91,6 +91,14 @@ Port::disconnect_all ()
bool
Port::connected_to (std::string const & o) const
{
+ if (!_engine->connected()) {
+ /* in some senses, this answer isn't the right one all the time,
+ because we know about our connections and will re-establish
+ them when we reconnect to JACK.
+ */
+ return false;
+ }
+
return jack_port_connected_to (_jack_port, _engine->make_port_name_non_relative(o).c_str ());
}
@@ -100,15 +108,17 @@ Port::get_connections (std::vector<std::string> & c) const
{
int n = 0;
- const char** jc = jack_port_get_connections (_jack_port);
- if (jc) {
- for (int i = 0; jc[i]; ++i) {
- c.push_back (jc[i]);
- ++n;
- }
-
- jack_free (jc);
- }
+ if (_engine->connected()) {
+ const char** jc = jack_port_get_connections (_jack_port);
+ if (jc) {
+ for (int i = 0; jc[i]; ++i) {
+ c.push_back (jc[i]);
+ ++n;
+ }
+
+ jack_free (jc);
+ }
+ }
return n;
}