summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-11 23:30:48 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-11 23:30:48 +0000
commit401c7091c805b24b926acb2b393070d3a32628a6 (patch)
tree240fd4ed7350e6e6fe75747cb904901154cf259d /libs/ardour
parent64dc5427e4f5339a16a018692dd94f476c53cae9 (diff)
switch to use boost::function for UI::call_slot operations, to avoid a serious thread safety issue with libsigc++
git-svn-id: svn://localhost/ardour2/branches/3.0@6355 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h16
-rw-r--r--libs/ardour/ardour/session_event.h13
-rw-r--r--libs/ardour/region.cc1
-rw-r--r--libs/ardour/session.cc2
-rw-r--r--libs/ardour/session_rtevents.cc18
5 files changed, 28 insertions, 22 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index c4f101ce5c..192dc09908 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -611,13 +611,13 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
bool soloing() const { return _non_soloed_outs_muted; }
bool listening() const { return _listen_cnt > 0; }
- static const sigc::slot<void,SessionEvent*> rt_cleanup;
+ static const SessionEvent::RTeventCallback rt_cleanup;
- void set_solo (boost::shared_ptr<RouteList>, bool, sigc::slot<void,SessionEvent*> after = rt_cleanup, bool group_override = false);
- void set_just_one_solo (boost::shared_ptr<Route>, bool, sigc::slot<void,SessionEvent*> after = rt_cleanup);
- void set_mute (boost::shared_ptr<RouteList>, bool, sigc::slot<void,SessionEvent*> after = rt_cleanup, bool group_override = false);
- void set_listen (boost::shared_ptr<RouteList>, bool, sigc::slot<void,SessionEvent*> after = rt_cleanup, bool group_override = false);
- void set_record_enable (boost::shared_ptr<RouteList>, bool, sigc::slot<void,SessionEvent*> after = rt_cleanup, bool group_override = false);
+ void set_solo (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+ void set_just_one_solo (boost::shared_ptr<Route>, bool, SessionEvent::RTeventCallback after = rt_cleanup);
+ void set_mute (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+ void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+ void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
sigc::signal<void,bool> SoloActive;
sigc::signal<void> SoloChanged;
@@ -1471,8 +1471,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
gint _have_rec_enabled_diskstream;
/* realtime "apply to set of routes" operations */
- SessionEvent* get_rt_event (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void,SessionEvent*> after, bool group_override,
- void (Session::*method) (boost::shared_ptr<RouteList>, bool, bool));
+ SessionEvent* get_rt_event (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override,
+ void (Session::*method) (boost::shared_ptr<RouteList>, bool, bool));
void rt_set_solo (boost::shared_ptr<RouteList>, bool yn, bool group_override);
void rt_set_just_one_solo (boost::shared_ptr<RouteList>, bool yn, bool /* ignored*/ );
diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h
index bb5b5f49ce..1a3303087d 100644
--- a/libs/ardour/ardour/session_event.h
+++ b/libs/ardour/ardour/session_event.h
@@ -2,6 +2,7 @@
#define __ardour_session_event_h__
#include <list>
+#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <sigc++/signal.h>
@@ -66,10 +67,14 @@ struct SessionEvent {
bool second_yes_or_no;
};
- boost::shared_ptr<RouteList> routes;
- sigc::slot<void> rt_slot; /* what to call in RT context */
- sigc::slot<void,SessionEvent*> rt_return; /* called after rt_slot, with this event as an argument */
- PBD::UICallback* ui;
+ /* 4 members to handle a multi-group event handled in RT context */
+
+ typedef boost::function<void (SessionEvent*)> RTeventCallback;
+
+ boost::shared_ptr<RouteList> routes; /* apply to */
+ boost::function<void (void)> rt_slot; /* what to call in RT context */
+ RTeventCallback rt_return; /* called after rt_slot, with this event as an argument */
+ PBD::UICallback* ui;
std::list<AudioRange> audio_range;
std::list<MusicRange> music_range;
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index cbfd9a9b33..33baa12d20 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1419,7 +1419,6 @@ void
Region::source_deleted (boost::shared_ptr<Source>)
{
_sources.clear ();
- drop_references ();
}
vector<string>
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 7b0e0603cb..0b71ad84cd 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -118,7 +118,7 @@ sigc::signal<void> Session::AutoBindingOff;
sigc::signal<void, std::string, std::string> Session::Exported;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
-const sigc::slot<void,SessionEvent*> Session::rt_cleanup (sigc::ptr_fun (&clean_up_session_event));
+const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
Session::Session (AudioEngine &eng,
const string& fullpath,
diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc
index 6d3e7ce78c..945e422076 100644
--- a/libs/ardour/session_rtevents.cc
+++ b/libs/ardour/session_rtevents.cc
@@ -16,6 +16,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <boost/bind.hpp>
+
#include "pbd/error.h"
#include "pbd/compose.h"
@@ -31,11 +33,11 @@ using namespace ARDOUR;
using namespace Glib;
SessionEvent*
-Session::get_rt_event (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void,SessionEvent*> after, bool group_override,
+Session::get_rt_event (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override,
void (Session::*method) (boost::shared_ptr<RouteList>, bool, bool))
{
SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
- ev->rt_slot = bind (sigc::mem_fun (*this, method), rl, yn, group_override);
+ ev->rt_slot = boost::bind (method, this, rl, yn, group_override);
ev->rt_return = after;
ev->ui = UICallback::get_ui_for_thread ();
@@ -43,7 +45,7 @@ Session::get_rt_event (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void
}
void
-Session::set_solo (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void,SessionEvent*> after, bool group_override)
+Session::set_solo (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
{
queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo));
}
@@ -61,7 +63,7 @@ Session::rt_set_solo (boost::shared_ptr<RouteList> rl, bool yn, bool group_overr
}
void
-Session::set_just_one_solo (boost::shared_ptr<Route> r, bool yn, sigc::slot<void,SessionEvent*> after)
+Session::set_just_one_solo (boost::shared_ptr<Route> r, bool yn, SessionEvent::RTeventCallback after)
{
/* its a bit silly to have to do this, but it keeps the API for this public method sane (we're
only going to solo one route) and keeps our ability to use get_rt_event() for the internal
@@ -92,7 +94,7 @@ Session::rt_set_just_one_solo (boost::shared_ptr<RouteList> just_one, bool yn, b
}
void
-Session::set_listen (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void,SessionEvent*> after, bool group_override)
+Session::set_listen (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
{
queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_listen));
}
@@ -110,7 +112,7 @@ Session::rt_set_listen (boost::shared_ptr<RouteList> rl, bool yn, bool group_ove
}
void
-Session::set_mute (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void,SessionEvent*> after, bool group_override)
+Session::set_mute (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
{
queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_mute));
}
@@ -128,7 +130,7 @@ Session::rt_set_mute (boost::shared_ptr<RouteList> rl, bool yn, bool group_overr
}
void
-Session::set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, sigc::slot<void,SessionEvent*> after, bool group_override)
+Session::set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
{
if (!writable()) {
return;
@@ -161,7 +163,7 @@ Session::process_rtop (SessionEvent* ev)
ev->rt_slot ();
if (ev->ui) {
- ev->ui->call_slot (bind (ev->rt_return, ev));
+ ev->ui->call_slot (boost::bind (ev->rt_return, ev));
} else {
warning << string_compose ("programming error: %1", X_("Session RT event queued from thread without a UI - cleanup in RT thread!")) << endmsg;
ev->rt_return (ev);