try just removing all PLATFORM_WINDOWS conditionals in ipmidi code to see if it will...
[ardour.git] / libs / pbd / pbd / signals.h
index 871a2c0b18964a1327974c1610f4afbf0129419e..97cfa65300a1bacab25dda5ebc4c7722b30ed695 100644 (file)
@@ -1,6 +1,6 @@
 /*
-    Copyright (C) 2009-2012 Paul Davis 
-    
+    Copyright (C) 2009-2012 Paul 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
     the Free Software Foundation; either version 2 of the License, or
 
 #include <list>
 #include <map>
+
+#ifdef nil
+#undef nil
+#endif
+
 #include <glibmm/threads.h>
 
 #include <boost/noncopyable.hpp>
 #include "pbd/libpbd_visibility.h"
 #include "pbd/event_loop.h"
 
+#ifndef NDEBUG
+#define DEBUG_PBD_SIGNAL_CONNECTIONS
+#endif
+
+#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
+#include "pbd/stacktrace.h"
+#include <iostream>
+#endif
+
 namespace PBD {
 
 class LIBPBD_API Connection;
@@ -41,11 +55,22 @@ class LIBPBD_API Connection;
 class LIBPBD_API SignalBase
 {
 public:
+       SignalBase ()
+#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
+       : _debug_connection (false)
+#endif
+       {}
        virtual ~SignalBase () {}
        virtual void disconnect (boost::shared_ptr<Connection>) = 0;
+#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
+       void set_debug_connection (bool yn) { _debug_connection = yn; }
+#endif
 
 protected:
         Glib::Threads::Mutex _mutex;
+#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
+       bool _debug_connection;
+#endif
 };
 
 class LIBPBD_API Connection : public boost::enable_shared_from_this<Connection>
@@ -74,7 +99,7 @@ private:
 };
 
 template<typename R>
-class LIBPBD_API OptionalLastValue
+class /*LIBPBD_API*/ OptionalLastValue
 {
 public:
        typedef boost::optional<R> result_type;
@@ -90,9 +115,9 @@ public:
                return r;
        }
 };
-       
+
 typedef boost::shared_ptr<Connection> UnscopedConnection;
-       
+
 class LIBPBD_API ScopedConnection
 {
 public:
@@ -114,7 +139,7 @@ public:
                if (_c == o) {
                        return *this;
                }
-               
+
                disconnect ();
                _c = o;
                return *this;
@@ -123,13 +148,13 @@ public:
 private:
        UnscopedConnection _c;
 };
-       
+
 class LIBPBD_API ScopedConnectionList  : public boost::noncopyable
 {
   public:
        ScopedConnectionList();
        virtual ~ScopedConnectionList ();
-       
+
        void add_connection (const UnscopedConnection& c);
        void drop_connections ();
 
@@ -141,9 +166,9 @@ class LIBPBD_API ScopedConnectionList  : public boost::noncopyable
           scoped connections needs to be protected in 2 cases:
 
           (1) (unlikely) we make a connection involving a callback on the
-              same object from 2 threads. (wouldn't that just be appalling 
+              same object from 2 threads. (wouldn't that just be appalling
               programming style?)
-            
+
           (2) where we are dropping connections in one thread and adding
               one from another.
         */
@@ -154,8 +179,8 @@ class LIBPBD_API ScopedConnectionList  : public boost::noncopyable
        ConnectionList _list;
 };
 
-#include "pbd/signals_generated.h"     
-       
+#include "pbd/signals_generated.h"
+
 } /* namespace */
 
 #endif /* __pbd_signals_h__ */