diff options
author | David Robillard <d@drobilla.net> | 2008-12-21 00:13:04 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-12-21 00:13:04 +0000 |
commit | 1ac39ebac020c8c020387cda7aaf1524823a3167 (patch) | |
tree | 13d7dc21c4233d3476cc3fc0e64ca4dcceb5de38 /src | |
parent | c3e910cca37092c1eaf125b585753a1d1e0823af (diff) | |
download | patchage-1ac39ebac020c8c020387cda7aaf1524823a3167.tar.gz patchage-1ac39ebac020c8c020387cda7aaf1524823a3167.tar.bz2 patchage-1ac39ebac020c8c020387cda7aaf1524823a3167.zip |
Fix crash for very short lived Jack ports (fix ticket #188).
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@1883 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/JackDriver.cpp | 10 | ||||
-rw-r--r-- | src/PatchageEvent.cpp | 2 | ||||
-rw-r--r-- | src/PortID.hpp | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 145ac78..8e9b78f 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -149,13 +149,18 @@ JackDriver::create_port_view(Patchage* patchage, if (id.type == PortID::JACK_ID) jack_port = jack_port_by_id(_client, id.id.jack_id); + if (jack_port == NULL) + return boost::shared_ptr<PatchagePort>(); + + const int jack_flags = jack_port_flags(jack_port); + string module_name, port_name; port_names(id, module_name, port_name); ModuleType type = InputOutput; if (_app->state_manager()->get_module_split(module_name, - (jack_port_flags(jack_port) & JackPortIsTerminal))) { - if (jack_port_flags(jack_port) & JackPortIsInput) { + (jack_flags & JackPortIsTerminal))) { + if (jack_flags & JackPortIsInput) { type = Input; } else { type = Output; @@ -191,6 +196,7 @@ JackDriver::create_port_view(Patchage* patchage, boost::shared_ptr<PatchagePort> JackDriver::create_port(boost::shared_ptr<PatchageModule> parent, jack_port_t* port) { + assert(port); const char* const type_str = jack_port_type(port); PortType port_type; diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index abff01b..6b14fd0 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -71,7 +71,7 @@ PatchageEvent::execute(Patchage* patchage) if (driver) { if ( ! driver->create_port_view(patchage, _port_1)) - cerr << "Unable to create port view (already exists?" << endl; + cerr << "Unable to create port view" << endl; } else { cerr << "ERROR: Create port with unknown port type" << endl; } diff --git a/src/PortID.hpp b/src/PortID.hpp index 022dc82..7d76d7a 100644 --- a/src/PortID.hpp +++ b/src/PortID.hpp @@ -49,7 +49,10 @@ struct PortID { union { #ifdef USE_LIBJACK - jack_port_id_t jack_id; + struct { + jack_port_id_t jack_id; + int jack_flags; + }; #endif #ifdef HAVE_ALSA snd_seq_addr_t alsa_addr; |