#include "libardour-config.h"
#endif
-#include <stdexcept>
-
#include <jack/weakjack.h> // so that we can test for new functions at runtime
-#include "pbd/error.h"
#include "pbd/compose.h"
+#include "pbd/error.h"
+#include "pbd/failed_constructor.h"
+#include "ardour/audioengine.h"
#include "ardour/debug.h"
#include "ardour/port.h"
-#include "ardour/audioengine.h"
-#include "pbd/failed_constructor.h"
#include "i18n.h"
using namespace PBD;
PBD::Signal2<void,boost::shared_ptr<Port>, boost::shared_ptr<Port> > Port::PostDisconnect;
+PBD::Signal0<void> Port::PortDrop;
AudioEngine* Port::_engine = 0;
bool Port::_connecting_blocked = false;
cerr << "Failed to register JACK port \"" << _name << "\", reason is unknown from here\n";
throw failed_constructor ();
}
+
+ PortDrop.connect_same_thread (drop_connection, boost::bind (&Port::drop, this));
}
/** Port destructor */
Port::~Port ()
{
- if (_engine->jack ()) {
- jack_port_unregister (_engine->jack (), _jack_port);
+ drop ();
+}
+
+void
+Port::drop ()
+{
+ if (_jack_port) {
+ if (_engine->jack ()) {
+ jack_port_unregister (_engine->jack (), _jack_port);
+ }
+ _jack_port = 0;
}
}