From 738387f9a417537e768d56d3fc4afcb9dc82d66b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 20 Dec 2009 16:50:41 +0000 Subject: [PATCH] remove a couple of boost::signals2 trouble spots; fix some --strict compile time warnings git-svn-id: svn://localhost/ardour2/branches/3.0@6378 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.cc | 29 +++++++---------- gtk2_ardour/time_axis_view_item.cc | 1 + libs/ardour/ardour/debug.h | 8 +++-- libs/ardour/ardour/midi_ui.h | 3 +- libs/ardour/ardour/session.h | 4 ++- libs/ardour/internal_send.cc | 2 +- libs/ardour/ladspa_plugin.cc | 2 +- libs/ardour/midi_ring_buffer.cc | 6 ++-- libs/ardour/midi_ui.cc | 1 + libs/ardour/session.cc | 3 +- libs/ardour/session_midi.cc | 5 +-- libs/ardour/session_process.cc | 2 +- libs/ardour/session_rtevents.cc | 8 ++--- libs/ardour/session_state.cc | 16 ++++++---- libs/ardour/tempo.cc | 2 +- libs/ardour/ticker.cc | 2 -- libs/gtkmm2ext/gtkmm2ext/dndvbox.h | 4 +-- libs/midi++2/jack_midiport.cc | 2 +- libs/pbd/pbd/abstract_ui.cc | 2 +- libs/pbd/pbd/signals.h | 2 +- libs/pbd/undo.cc | 1 + .../control_protocol/control_protocol.h | 2 +- .../generic_midi_control_protocol.cc | 32 +++++++++++-------- .../generic_midi_control_protocol.h | 3 +- wscript | 2 +- 25 files changed, 76 insertions(+), 68 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 57d1ef0922..9bf2ccbc5d 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -682,6 +682,7 @@ Editor::Editor () ControlProtocol::ZoomOut.connect (*this, boost::bind (&Editor::temporal_zoom_step, this, true)); ControlProtocol::ScrollTimeline.connect (*this, boost::bind (&Editor::control_scroll, this, _1)); BasicUI::AccessAction.connect (*this, boost::bind (&Editor::access_action, this, _1, _2)); + Session::AskAboutPlaylistDeletion.connect (*this, boost::bind (&Editor::playlist_deletion_dialog, this, _1)); Config->ParameterChanged.connect (*this, boost::bind (&Editor::parameter_changed, this, _1)); @@ -1075,8 +1076,6 @@ Editor::set_session (Session *t) update_title (); - _session->history().Changed.connect (_session_connections, boost::bind (&Editor::history_changed, this)); - /* These signals can all be emitted by a non-GUI thread. Therefore the handlers for them must not attempt to directly interact with the GUI, but use Gtkmm2ext::UI::instance()->call_slot(); @@ -1087,12 +1086,17 @@ Editor::set_session (Session *t) _session->RouteAdded.connect (_session_connections, boost::bind (&Editor::handle_new_route, this, _1)); _session->DurationChanged.connect (_session_connections, boost::bind (&Editor::handle_new_duration, this)); _session->DirtyChanged.connect (_session_connections, boost::bind (&Editor::update_title, this)); - _session->StateSaved.connect (_session_connections, boost::bind (&Editor::update_title, this)); - _session->AskAboutPlaylistDeletion.connect (_session_connections, boost::bind (&Editor::playlist_deletion_dialog, this, _1)); _session->TimecodeOffsetChanged.connect (_session_connections, boost::bind (&Editor::update_just_timecode, this)); _session->tempo_map().StateChanged.connect (_session_connections, boost::bind (&Editor::tempo_map_changed, this, _1)); _session->Located.connect (_session_connections, boost::bind (&Editor::located, this)); _session->config.ParameterChanged.connect (_session_connections, boost::bind (&Editor::parameter_changed, this, _1)); + _session->StateSaved.connect (_session_connections, boost::bind (&Editor::session_state_saved, this, _1)); + _session->locations()->added.connect (_session_connections, sigc::mem_fun(*this, &Editor::add_new_location)); + _session->locations()->removed.connect (_session_connections, sigc::mem_fun(*this, &Editor::location_gone)); + _session->locations()->changed.connect (_session_connections, sigc::mem_fun(*this, &Editor::refresh_location_display)); + _session->locations()->StateChanged.connect (_session_connections, sigc::mem_fun(*this, &Editor::refresh_location_display_s)); + _session->locations()->end_location()->changed.connect (_session_connections, sigc::mem_fun(*this, &Editor::end_location_changed)); + _session->history().Changed.connect (_session_connections, boost::bind (&Editor::history_changed, this)); if (Profile->get_sae()) { BBT_Time bbt; @@ -1139,19 +1143,7 @@ Editor::set_session (Session *t) Config->map_parameters (pc); _session->config.map_parameters (pc); - refresh_location_display (); - - /* static signal - no need to drop connection when session is deleted (XXX or we are?)*/ - - _session->StateSaved.connect (*this, boost::bind (&Editor::session_state_saved, this, _1)); - - _session->locations()->added.connect (_session_connections, sigc::mem_fun(*this, &Editor::add_new_location)); - _session->locations()->removed.connect (_session_connections, sigc::mem_fun(*this, &Editor::location_gone)); - _session->locations()->changed.connect (_session_connections, sigc::mem_fun(*this, &Editor::refresh_location_display)); - _session->locations()->StateChanged.connect (_session_connections, sigc::mem_fun(*this, &Editor::refresh_location_display_s)); - _session->locations()->end_location()->changed.connect (_session_connections, sigc::mem_fun(*this, &Editor::end_location_changed)); - handle_new_duration (); restore_ruler_visibility (); @@ -3920,8 +3912,9 @@ Editor::control_layout_scroll (GdkEventScroll* ev) void Editor::session_state_saved (string snap_name) { - ENSURE_GUI_THREAD (*this, &Editor::session_state_saved, snap_name) - + ENSURE_GUI_THREAD (*this, &Editor::session_state_saved, snap_name); + + update_title (); _snapshots->redisplay (); } diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index dedacaa27c..19b599215b 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -113,6 +113,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group& TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other) : sigc::trackable(other) + , PBD::ScopedConnectionList() , trackview (other.trackview) { diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index 2998771dba..3951fe11ef 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -50,7 +50,8 @@ namespace ARDOUR { Transport = 0x400, Slave = 0x800, SessionEvents = 0x800, - MidiIO = 0x1000 + MidiIO = 0x1000, + MackieControl = 0x2000 }; } @@ -58,12 +59,13 @@ namespace ARDOUR { #ifndef NDEBUG #define DEBUG_TRACE(bits,str) if ((bits) & ARDOUR::debug_bits) { ARDOUR::debug_print (# bits, str); } -#define DEBUG_STR_SET(id,s) std::stringstream __debug_str ## id; __debug_str ## id << s; +#define DEBUG_STR_DECL(id) std::stringstream __debug_str ## id; #define DEBUG_STR(id) __debug_str ## id +#define DEBUG_STR_APPEND(id,s) __debug_str ## id << s; #else #define DEBUG_TRACE(bits,fmt,...) /*empty*/ -#define DEBUG_STR_SET(a,b) /* empty */ #define DEBUG_STR(a) /* empty */ +#define DEBUG_STR_APPEND(a,b) /* empty */ #endif #endif /* __ardour_debug_h__ */ diff --git a/libs/ardour/ardour/midi_ui.h b/libs/ardour/ardour/midi_ui.h index 869d7ab708..c21182f4e2 100644 --- a/libs/ardour/ardour/midi_ui.h +++ b/libs/ardour/ardour/midi_ui.h @@ -4,9 +4,10 @@ #include #include #include "pbd/abstract_ui.h" +#include "pbd/signals.h" namespace MIDI { - class port; + class Port; } namespace ARDOUR { diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 7c6c83a121..59a282fe1d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -548,7 +548,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi 0 for "yes, delete this playlist", 1 for "no, don't delete this playlist". */ - PBD::Signal1 > AskAboutPlaylistDeletion; + static PBD::Signal1 > AskAboutPlaylistDeletion; /** handlers should return 0 for "ignore the rate mismatch", !0 for "do not use this session" @@ -1464,6 +1464,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void update_have_rec_enabled_diskstream (); gint _have_rec_enabled_diskstream; + static int ask_about_playlist_deletion (boost::shared_ptr); + /* realtime "apply to set of routes" operations */ SessionEvent* get_rt_event (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override, void (Session::*method) (boost::shared_ptr, bool, bool)); diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index 7fc2efe9b9..8e9010b148 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -173,7 +173,7 @@ InternalSend::get_state() } int -InternalSend::set_our_state (const XMLNode& node, int version) +InternalSend::set_our_state (const XMLNode& node, int /*version*/) { const XMLProperty* prop; diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index b0d64ad41b..bbd29e960e 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -427,7 +427,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version) } int -LadspaPlugin::set_state_2X (const XMLNode& node, int version) +LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) { XMLNodeList nodes; XMLProperty *prop; diff --git a/libs/ardour/midi_ring_buffer.cc b/libs/ardour/midi_ring_buffer.cc index df49b570c7..a050422ae5 100644 --- a/libs/ardour/midi_ring_buffer.cc +++ b/libs/ardour/midi_ring_buffer.cc @@ -107,8 +107,10 @@ MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end, nframes #ifndef NDEBUG DEBUG_TRACE (DEBUG::MidiDiskstreamIO, "wrote MidiEvent to Buffer: "); for (size_t i=0; i < ev_size; ++i) { - DEBUG_STR_SET(a, hex); - DEBUG_STR(a) << "0x" << (int)write_loc[i] << ' '; + DEBUG_STR_DECL(a); + DEBUG_STR_APPEND(a,hex); + DEBUG_STR_APPEND(a,"0x"); + DEBUG_STR_APPEND(a,(int)write_loc[i]); DEBUG_TRACE (DEBUG::MidiDiskstreamIO, DEBUG_STR(a).str()); } DEBUG_TRACE (DEBUG::MidiDiskstreamIO, "\n"); diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc index be7a2bafc0..38f856b5a2 100644 --- a/libs/ardour/midi_ui.cc +++ b/libs/ardour/midi_ui.cc @@ -124,6 +124,7 @@ MidiControlUI::reset_ports () for (MIDI::Manager::PortList::iterator i = plist.begin(); i != plist.end(); ++i) { int fd; + if ((fd = (*i)->selectable ()) >= 0) { Glib::RefPtr psrc = IOSource::create (fd, IO_IN|IO_HUP|IO_ERR); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index b2a1aa8da8..8d707545fe 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -114,6 +114,7 @@ PBD::Signal0 Session::EndTimeChanged; PBD::Signal0 Session::AutoBindingOn; PBD::Signal0 Session::AutoBindingOff; PBD::Signal2 Session::Exported; +PBD::Signal1 > Session::AskAboutPlaylistDeletion; static void clean_up_session_event (SessionEvent* ev) { delete ev; } const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event); @@ -387,8 +388,6 @@ Session::destroy () AudioDiskstream::free_working_buffers(); - // BOOST::SIGNALS: Route::SyncOrderKeys.clear(); - DEBUG_TRACE (DEBUG::Destruction, "delete named selections\n"); for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ) { NamedSelectionList::iterator tmp; diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 4f0c70aa20..bd06fe78ee 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -872,8 +872,9 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes) } #ifndef NDEBUG - DEBUG_STR_SET(foo,"sending "); - DEBUG_STR(foo) << transmitting_timecode_time; + DEBUG_STR_DECL(foo) + DEBUG_STR_APPEND(foo,"sending "); + DEBUG_STR_APPEND(foo, transmitting_timecode_time); DEBUG_TRACE (DEBUG::MTC, string_compose ("%1 qfm = %2, stamp = %3\n", DEBUG_STR(foo).str(), next_quarter_frame_to_send, out_stamp)); #endif diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 9766a1b159..9baa0aea9e 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -578,7 +578,7 @@ Session::follow_slave (nframes_t nframes) } #if 1 - if (abs(average_slave_delta) > _slave->resolution()) { + if ((nframes_t) abs(average_slave_delta) > _slave->resolution()) { cerr << "average slave delta greater than slave resolution (" << _slave->resolution() << "), going to silent motion\n"; goto silent_motion; } diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc index 945e422076..7bb27db808 100644 --- a/libs/ardour/session_rtevents.cc +++ b/libs/ardour/session_rtevents.cc @@ -33,7 +33,7 @@ using namespace ARDOUR; using namespace Glib; SessionEvent* -Session::get_rt_event (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override, +Session::get_rt_event (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override, void (Session::*method) (boost::shared_ptr, bool, bool)) { SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0); @@ -51,7 +51,7 @@ Session::set_solo (boost::shared_ptr rl, bool yn, SessionEvent::RTeve } void -Session::rt_set_solo (boost::shared_ptr rl, bool yn, bool group_override) +Session::rt_set_solo (boost::shared_ptr rl, bool yn, bool /* group_override */) { for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { if (!(*i)->is_hidden()) { @@ -100,7 +100,7 @@ Session::set_listen (boost::shared_ptr rl, bool yn, SessionEvent::RTe } void -Session::rt_set_listen (boost::shared_ptr rl, bool yn, bool group_override) +Session::rt_set_listen (boost::shared_ptr rl, bool yn, bool /*group_override*/ ) { for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { if (!(*i)->is_hidden()) { @@ -118,7 +118,7 @@ Session::set_mute (boost::shared_ptr rl, bool yn, SessionEvent::RTeve } void -Session::rt_set_mute (boost::shared_ptr rl, bool yn, bool group_override) +Session::rt_set_mute (boost::shared_ptr rl, bool yn, bool /*group_override*/) { for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { if (!(*i)->is_hidden()) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 16cbfd1d36..bcd074a516 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -276,10 +276,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) Processor::ProcessorCreated.connect (*this, boost::bind (&Session::add_processor, this, _1)); NamedSelection::NamedSelectionCreated.connect (*this, boost::bind (&Session::add_named_selection, this, _1)); AutomationList::AutomationListCreated.connect (*this, boost::bind (&Session::add_automation_list, this, _1)); - - // BOOST SIGNALS - // Controllable::Destroyed.connect (*this, boost::bind (&Session::remove_controllable, this, _1)); - + Controllable::Destroyed.connect (*this, boost::bind (&Session::remove_controllable, this, _1)); IO::PortCountChanged.connect (*this, boost::bind (&Session::ensure_buffers, this, _1)); /* stop IO objects from doing stuff until we're ready for them */ @@ -2290,6 +2287,12 @@ struct RegionCounter { RegionCounter() : count (0) {} }; +int +Session::ask_about_playlist_deletion (boost::shared_ptr p) +{ + return *AskAboutPlaylistDeletion (p); +} + int Session::cleanup_sources (CleanupReport& rep) { @@ -2311,12 +2314,11 @@ Session::cleanup_sources (CleanupReport& rep) /* step 1: consider deleting all unused playlists */ -/* BOOST SIGNALS - if (playlists->maybe_delete_unused (boost::bind (AskAboutPlaylistDeletion, _1)); + if (playlists->maybe_delete_unused (boost::bind (Session::ask_about_playlist_deletion, _1))) { ret = 0; goto out; } -*/ + /* step 2: find all un-used sources */ rep.paths.clear (); diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 9536576713..9dcce637e6 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1687,7 +1687,7 @@ TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& other) const * add the BBT interval @param increment to @param start and return the result */ BBT_Time -TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& increment, const TempoMetric& metric) const +TempoMap::bbt_add (const BBT_Time& start, const BBT_Time& increment, const TempoMetric& /*metric*/) const { BBT_Time result = start; BBT_Time op = increment; /* argument is const, but we need to modify it */ diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc index 30d6c5f2d0..f35f84e889 100644 --- a/libs/ardour/ticker.cc +++ b/libs/ardour/ticker.cc @@ -135,7 +135,6 @@ void MidiClockTicker::transport_looped() void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /*transport_bbt*/, const Timecode::Time& /*transport_smpt*/) { -#ifdef WITH_JACK_MIDI if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f) return; @@ -162,7 +161,6 @@ void MidiClockTicker::tick(const nframes_t& transport_frames, const BBT_Time& /* _last_tick = next_tick; } -#endif // WITH_JACK_MIDI } double MidiClockTicker::one_ppqn_in_frames(nframes_t transport_position) diff --git a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h index 166544d73f..486f31f084 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndvbox.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndvbox.h @@ -142,7 +142,7 @@ public: * @param y y coordinate. * @return Pair consisting of the child under (x, y) (or 0) and the index of the child under (x, y) (or -1) */ - std::pair get_child_at_position (int x, int y) const + std::pair get_child_at_position (int /*x*/, int y) const { std::list children = _internal_vbox.get_children (); std::list::iterator i = children.begin(); @@ -202,7 +202,7 @@ private: } void drag_data_received ( - Glib::RefPtr const & context, int x, int y, Gtk::SelectionData const & selection_data, guint info, guint time + Glib::RefPtr const & context, int x, int y, Gtk::SelectionData const & selection_data, guint /*info*/, guint time ) { /* work out where it was dropped */ diff --git a/libs/midi++2/jack_midiport.cc b/libs/midi++2/jack_midiport.cc index 9b96155b88..ab6c598c8d 100644 --- a/libs/midi++2/jack_midiport.cc +++ b/libs/midi++2/jack_midiport.cc @@ -212,7 +212,7 @@ JACK_MidiPort::flush (void* jack_port_buffer) } int -JACK_MidiPort::read (byte * buf, size_t bufsize) +JACK_MidiPort::read (byte *, size_t) { timestamp_t time; Evoral::EventType type; diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc index e5319c2107..98ef094a00 100644 --- a/libs/pbd/pbd/abstract_ui.cc +++ b/libs/pbd/pbd/abstract_ui.cc @@ -17,7 +17,7 @@ AbstractUI::AbstractUI (const string& name) } template void -AbstractUI::register_thread (string target_gui, pthread_t thread_id, string thread_name, uint32_t num_requests) +AbstractUI::register_thread (string target_gui, pthread_t thread_id, string /*thread name*/, uint32_t num_requests) { if (target_gui != name()) { return; diff --git a/libs/pbd/pbd/signals.h b/libs/pbd/pbd/signals.h index 4ddd72eba8..47e8d143bc 100644 --- a/libs/pbd/pbd/signals.h +++ b/libs/pbd/pbd/signals.h @@ -46,7 +46,7 @@ class ScopedConnectionList : public boost::noncopyable private: /* this class is not copyable */ - ScopedConnectionList(const ScopedConnectionList&) {} + ScopedConnectionList(const ScopedConnectionList&); /* this lock is shared by all instances of a ScopedConnectionList. We do not want one mutex per list, and since we only need the lock diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index d3f01d5ada..1a2574ae28 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -38,6 +38,7 @@ UndoTransaction::UndoTransaction () UndoTransaction::UndoTransaction (const UndoTransaction& rhs) : Command(rhs._name) + , PBD::ScopedConnectionList () , _clearing(false) { clear (); diff --git a/libs/surfaces/control_protocol/control_protocol/control_protocol.h b/libs/surfaces/control_protocol/control_protocol/control_protocol.h index 8a50caf05f..c80ba9b4b6 100644 --- a/libs/surfaces/control_protocol/control_protocol/control_protocol.h +++ b/libs/surfaces/control_protocol/control_protocol/control_protocol.h @@ -109,7 +109,7 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu void prev_track (uint32_t initial_id); private: - ControlProtocol (const ControlProtocol&) {} /* noncopyable */ + ControlProtocol (const ControlProtocol&); /* noncopyable */ }; extern "C" { diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index efe2089237..e9f12638b6 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -149,9 +149,10 @@ GenericMidiControlProtocol::start_learning (Controllable* c) for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ) { ptmp = i; ++ptmp; - if (((*i).first)->get_controllable() == c) { - (*i).second.disconnect(); - delete (*i).first; + if (((*i)->first)->get_controllable() == c) { + (*i)->second.disconnect(); + delete (*i)->first; + delete *i; pending_controllables.erase (i); } i = ptmp; @@ -174,13 +175,11 @@ GenericMidiControlProtocol::start_learning (Controllable* c) { Glib::Mutex::Lock lm (pending_lock); -#if 0 // BOOST SIGNALS - std::pair element; - element.first = mc; - element.second = c->LearningFinished.connect (bind (mem_fun (*this, &GenericMidiControlProtocol::learning_stopped), mc)); + MIDIPendingControllable* element = new MIDIPendingControllable; + element->first = mc; + c->LearningFinished.connect (element->second, boost::bind (&GenericMidiControlProtocol::learning_stopped, this, mc)); pending_controllables.push_back (element); -#endif } mc->learn_about_external_control (); @@ -199,8 +198,9 @@ GenericMidiControlProtocol::learning_stopped (MIDIControllable* mc) tmp = i; ++tmp; - if ( (*i).first == mc) { - (*i).second.disconnect(); + if ( (*i)->first == mc) { + (*i)->second.disconnect(); + delete *i; pending_controllables.erase(i); } @@ -222,11 +222,12 @@ GenericMidiControlProtocol::stop_learning (Controllable* c) */ for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ++i) { - if (((*i).first)->get_controllable() == c) { - (*i).first->stop_learning (); - dptr = (*i).first; - (*i).second.disconnect(); + if (((*i)->first)->get_controllable() == c) { + (*i)->first->stop_learning (); + dptr = (*i)->first; + (*i)->second.disconnect(); + delete *i; pending_controllables.erase (i); break; } @@ -350,6 +351,9 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version) { Glib::Mutex::Lock lm (pending_lock); + for (MIDIPendingControllables::iterator i = pending_controllables.begin(); i != pending_controllables.end(); ++i) { + delete *i; + } pending_controllables.clear (); } diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h index 828bb4e6be..c42d796e81 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h @@ -51,7 +51,8 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol { typedef std::set MIDIControllables; MIDIControllables controllables; - typedef std::list > MIDIPendingControllables; + typedef std::pair MIDIPendingControllable; + typedef std::list MIDIPendingControllables; MIDIPendingControllables pending_controllables; Glib::Mutex controllables_lock; Glib::Mutex pending_lock; diff --git a/wscript b/wscript index b08561fc12..375e769eca 100644 --- a/wscript +++ b/wscript @@ -82,7 +82,7 @@ def create_stored_revision(): try: text = '#include "ardour/svn_revision.h"\n' - text += 'namespace ARDOUR { extern const char* svn_revision = \"' + rev + '\"; }\n' + text += 'namespace ARDOUR { const char* svn_revision = \"' + rev + '\"; }\n' print 'Writing svn revision info to libs/ardour/svn_revision.cc' o = file('libs/ardour/svn_revision.cc', 'w') o.write(text)