change PBD::Transmitter code to use PBD::Signal<> not sigc::signal<>, since the latte...
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 14 Aug 2016 12:33:23 +0000 (08:33 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 14 Aug 2016 12:33:23 +0000 (08:33 -0400)
libs/pbd/pbd/receiver.h
libs/pbd/pbd/transmitter.h
libs/pbd/receiver.cc

index e7f3f25b0bedc7eae1effe05bfbfe48b56491645..2f44deb93ffcc130351bc4d1113ba5ebf40e779d 100644 (file)
@@ -42,7 +42,7 @@ class LIBPBD_API Receiver : public sigc::trackable
        virtual void receive (Transmitter::Channel, const char *) = 0;
 
   private:
-       std::vector<sigc::connection *> connections;
+       PBD::ScopedConnectionList connections;
 };
 
 #endif  // __libmisc_receiver_h__
index a765f9e370721b586446a5533ab4496b348ad215..47ab9c7e3e92ffcf034d069295f79bdc3f3553ce 100644 (file)
@@ -23,7 +23,7 @@
 #include <sstream>
 #include <iostream>
 
-#include <sigc++/sigc++.h>
+#include <pbd/signals.h>
 
 #include "pbd/libpbd_visibility.h"
 
@@ -41,7 +41,7 @@ class LIBPBD_API Transmitter : public std::stringstream
 
        Transmitter (Channel);
 
-       sigc::signal<void,Channel, const char *> &sender() {
+       PBD::Signal2<void,Channel, const char *> &sender() {
                return *send;
        }
 
@@ -53,12 +53,12 @@ class LIBPBD_API Transmitter : public std::stringstream
 
   private:
        Channel channel;
-       sigc::signal<void, Channel, const char *> *send;
+       PBD::Signal2<void, Channel, const char *> *send;
 
-       sigc::signal<void, Channel, const char *> info;
-       sigc::signal<void, Channel, const char *> warning;
-       sigc::signal<void, Channel, const char *> error;
-       sigc::signal<void, Channel, const char *> fatal;
+       PBD::Signal2<void, Channel, const char *> info;
+       PBD::Signal2<void, Channel, const char *> warning;
+       PBD::Signal2<void, Channel, const char *> error;
+       PBD::Signal2<void, Channel, const char *> fatal;
 };
 
 /* for EGCS 2.91.66, if this function is not compiled within the same
index b0655721ada26ea290873e6e603078baab5b2514..689665c84abf21024ab216c067c490940d827770 100644 (file)
@@ -37,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);
 }