mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-27 17:07:40 +01:00
provide compile-time-enabled/disabled debugging of connections being made to PBD::Signal via PBD::SignalBase::set_debug_connection()
This commit is contained in:
parent
7f7437390e
commit
76b2aee8ae
2 changed files with 19 additions and 0 deletions
|
|
@ -39,6 +39,13 @@
|
|||
#include "pbd/libpbd_visibility.h"
|
||||
#include "pbd/event_loop.h"
|
||||
|
||||
#define DEBUG_PBD_SIGNAL_CONNECTIONS
|
||||
|
||||
#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
|
||||
#include "pbd/stacktrace.h"
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
namespace PBD {
|
||||
|
||||
class LIBPBD_API Connection;
|
||||
|
|
@ -46,11 +53,18 @@ class LIBPBD_API Connection;
|
|||
class LIBPBD_API SignalBase
|
||||
{
|
||||
public:
|
||||
SignalBase () : _debug_connection (false) {}
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -286,6 +286,11 @@ def signal(f, n, v):
|
|||
print("""
|
||||
boost::shared_ptr<Connection> _connect (slot_function_type f)
|
||||
{
|
||||
#ifdef DEBUG_PBD_SIGNAL_CONNECTIONS
|
||||
if (_debug_connection) {
|
||||
PBD::stacktrace (std::cerr, 10);
|
||||
}
|
||||
#endif
|
||||
boost::shared_ptr<Connection> c (new Connection (this));
|
||||
Glib::Threads::Mutex::Lock lm (_mutex);
|
||||
_slots[c] = f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue