MIDI tracer actually changes the event-loop
[ardour.git] / libs / pbd / receiver.cc
index 5e7c10de707f6278bbe47b29cfc2d5ba95e82437..689665c84abf21024ab216c067c490940d827770 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 1998-99 Paul Barton-Davis 
+    Copyright (C) 1998-99 Paul Barton-Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include <vector>
 
-#include <pbd/receiver.h>
-#include <pbd/transmitter.h>
+#include "pbd/receiver.h"
+#include "pbd/transmitter.h"
 
+using namespace std;
 using namespace sigc;
 
 Receiver::Receiver () {}
@@ -36,23 +37,17 @@ Receiver::~Receiver ()
 void
 Receiver::hangup ()
 {
-       vector<sigc::connection *>::iterator i;
-
-       for (i = connections.begin(); i != connections.end (); i++) {
-               (*i)->disconnect ();
-               delete *i;
-       }
-
-       connections.erase (connections.begin(), connections.end());
+       connections.drop_connections ();
 }
 
 void
 Receiver::listen_to (Transmitter &transmitter)
 
 {
-       sigc::connection *c = new sigc::connection;
-
-       (*c) = transmitter.sender().connect(mem_fun(*this, &Receiver::receive));
+       /* odd syntax here because boost's placeholders (_1, _2) are in an
+          anonymous namespace which causes ambiguity with sigc++ (and will also
+          do so with std::placeholder in the C++11 future
+       */
+       transmitter.sender().connect_same_thread (connections, boost::bind (&Receiver::receive, this, boost::arg<1>(), boost::arg<2>()));
 
-       connections.push_back (c);
 }