mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
Delete MIDI port objects when the MackieControlProtocol is torn down, so that it can be recreated without attempting to create duplicate JACK port names. Should fix #3886.
git-svn-id: svn://localhost/ardour2/branches/3.0@10129 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
d6112f1213
commit
a7dc433498
3 changed files with 31 additions and 2 deletions
|
|
@ -76,6 +76,16 @@ Manager::add_port (Port* p)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Manager::remove_port (Port* p)
|
||||||
|
{
|
||||||
|
RCUWriter<PortList> writer (_ports);
|
||||||
|
boost::shared_ptr<PortList> pw = writer.get_copy ();
|
||||||
|
pw->remove (p);
|
||||||
|
|
||||||
|
PortsChanged (); /* EMIT SIGNAL */
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Manager::cycle_start (pframes_t nframes)
|
Manager::cycle_start (pframes_t nframes)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class Manager {
|
||||||
Port *midi_clock_output_port() const { return _midi_clock_output_port; }
|
Port *midi_clock_output_port() const { return _midi_clock_output_port; }
|
||||||
|
|
||||||
Port* add_port (Port *);
|
Port* add_port (Port *);
|
||||||
|
void remove_port (Port *);
|
||||||
|
|
||||||
Port* port (std::string const &);
|
Port* port (std::string const &);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@
|
||||||
#include "mackie_control_exception.h"
|
#include "mackie_control_exception.h"
|
||||||
#include "controls.h"
|
#include "controls.h"
|
||||||
|
|
||||||
#include <midi++/types.h>
|
#include "midi++/types.h"
|
||||||
#include <midi++/port.h>
|
#include "midi++/port.h"
|
||||||
|
#include "midi++/manager.h"
|
||||||
#include <sigc++/sigc++.h>
|
#include <sigc++/sigc++.h>
|
||||||
#include <boost/shared_array.hpp>
|
#include <boost/shared_array.hpp>
|
||||||
|
|
||||||
|
|
@ -40,6 +41,10 @@ SurfacePort::SurfacePort()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param input_port Input MIDI::Port; this object takes responsibility for removing it from
|
||||||
|
* the MIDI::Manager and destroying it.
|
||||||
|
* @param output_port Output MIDI::Port; responsibility similarly taken.
|
||||||
|
*/
|
||||||
SurfacePort::SurfacePort (MIDI::Port & input_port, MIDI::Port & output_port, int number)
|
SurfacePort::SurfacePort (MIDI::Port & input_port, MIDI::Port & output_port, int number)
|
||||||
: _input_port (&input_port), _output_port (&output_port), _number (number), _active (false)
|
: _input_port (&input_port), _output_port (&output_port), _number (number), _active (false)
|
||||||
{
|
{
|
||||||
|
|
@ -53,6 +58,19 @@ SurfacePort::~SurfacePort()
|
||||||
// make sure another thread isn't reading or writing as we close the port
|
// make sure another thread isn't reading or writing as we close the port
|
||||||
Glib::RecMutex::Lock lock( _rwlock );
|
Glib::RecMutex::Lock lock( _rwlock );
|
||||||
_active = false;
|
_active = false;
|
||||||
|
|
||||||
|
MIDI::Manager* mm = MIDI::Manager::instance ();
|
||||||
|
|
||||||
|
if (_input_port) {
|
||||||
|
mm->remove_port (_input_port);
|
||||||
|
delete _input_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_output_port) {
|
||||||
|
mm->remove_port (_output_port);
|
||||||
|
delete _output_port;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PORT_DEBUG
|
#ifdef PORT_DEBUG
|
||||||
cout << "~SurfacePort::SurfacePort() finished" << endl;
|
cout << "~SurfacePort::SurfacePort() finished" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue