rationalize destruction pathway (some more); tidy-ify some ImageFrame code

git-svn-id: svn://localhost/ardour2/branches/3.0@6398 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-12-25 21:06:52 +00:00
parent f53cbaede8
commit b6f4cdaea2
28 changed files with 283 additions and 263 deletions

View file

@ -1186,8 +1186,6 @@ AudioRegionView::add_ghost (TimeAxisView& tv)
ghost->set_colors(); ghost->set_colors();
ghosts.push_back (ghost); ghosts.push_back (ghost);
ghost->CatchDeletion.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
return ghost; return ghost;
} }

View file

@ -44,7 +44,6 @@ using namespace Gtkmm2ext;
using namespace ARDOUR; using namespace ARDOUR;
list<Gdk::Color> AxisView::used_colors; list<Gdk::Color> AxisView::used_colors;
PBD::Signal1<void,AxisView*> AxisView::CatchDeletion;
AxisView::AxisView (ARDOUR::Session* sess) AxisView::AxisView (ARDOUR::Session* sess)
: SessionHandlePtr (sess) : SessionHandlePtr (sess)

View file

@ -60,8 +60,6 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
_marked_for_display = yn; _marked_for_display = yn;
} }
static PBD::Signal1<void,AxisView*> CatchDeletion;
sigc::signal<void> Hiding; sigc::signal<void> Hiding;
void set_old_order_key (uint32_t ok) { _old_order_key = ok; } void set_old_order_key (uint32_t ok) { _old_order_key = ok; }

View file

@ -310,7 +310,6 @@ Editor::Editor ()
_show_waveforms_recording = true; _show_waveforms_recording = true;
show_gain_after_trim = false; show_gain_after_trim = false;
verbose_cursor_on = true; verbose_cursor_on = true;
route_removal = false;
last_item_entered = 0; last_item_entered = 0;
last_item_entered_n = 0; last_item_entered_n = 0;
@ -688,6 +687,8 @@ Editor::Editor ()
Config->ParameterChanged.connect (*this, ui_bind (&Editor::parameter_changed, this, _1), gui_context()); Config->ParameterChanged.connect (*this, ui_bind (&Editor::parameter_changed, this, _1), gui_context());
TimeAxisView::CatchDeletion.connect (*this, ui_bind (&Editor::timeaxisview_deleted, this, _1), gui_context());
_last_normalization_value = 0; _last_normalization_value = 0;
constructed = true; constructed = true;
@ -4803,8 +4804,6 @@ Editor::handle_new_route (RouteList& routes)
rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added)); rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
rtv->view()->HeightChanged.connect (sigc::mem_fun (*this, &Editor::streamview_height_changed)); rtv->view()->HeightChanged.connect (sigc::mem_fun (*this, &Editor::streamview_height_changed));
route->DropReferences.connect (*this, boost::bind (&Editor::remove_route, this, rtv), gui_context());
} }
_routes->routes_added (new_views); _routes->routes_added (new_views);
@ -4819,26 +4818,15 @@ Editor::handle_new_route (RouteList& routes)
} }
void void
Editor::remove_route (TimeAxisView *tv) Editor::timeaxisview_deleted (TimeAxisView *tv)
{ {
ENSURE_GUI_THREAD (*this, &Editor::remove_route, tv) if (_session && _session->deletion_in_progress()) {
/* the situation is under control */
TrackViewList::iterator i;
if ((i = find (track_views.begin(), track_views.end(), tv)) == track_views.end()) {
/* this track view has already been removed by someone else; e.g. when
* the session goes away, all TimeAxisViews are removed by the Editor's
* session_going_away handler.
*/
return; return;
} }
boost::shared_ptr<Route> route; ENSURE_GUI_THREAD (*this, &Editor::timeaxisview_deleted, tv);
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
if (rtav) {
route = rtav->route ();
}
TimeAxisView* next_tv = 0;
_routes->route_removed (tv); _routes->route_removed (tv);
@ -4846,7 +4834,26 @@ Editor::remove_route (TimeAxisView *tv)
entered_track = 0; entered_track = 0;
} }
/* remove it from the list of track views */
TrackViewList::iterator i;
if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) {
i = track_views.erase (i); i = track_views.erase (i);
}
/* update whatever the current mixer strip is displaying, if revelant */
boost::shared_ptr<Route> route;
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
if (rtav) {
route = rtav->route ();
}
if (current_mixer_strip && current_mixer_strip->route() == route) {
TimeAxisView* next_tv;
if (track_views.empty()) { if (track_views.empty()) {
next_tv = 0; next_tv = 0;
@ -4856,7 +4863,6 @@ Editor::remove_route (TimeAxisView *tv)
next_tv = (*i); next_tv = (*i);
} }
if (current_mixer_strip && current_mixer_strip->route() == route) {
if (next_tv) { if (next_tv) {
set_selected_mixer_strip (*next_tv); set_selected_mixer_strip (*next_tv);
@ -4868,7 +4874,6 @@ Editor::remove_route (TimeAxisView *tv)
ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer"); ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
} }
} }
} }
void void

View file

@ -618,8 +618,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void add_selection_context_items (Gtk::Menu_Helpers::MenuList&); void add_selection_context_items (Gtk::Menu_Helpers::MenuList&);
void handle_new_route (ARDOUR::RouteList&); void handle_new_route (ARDOUR::RouteList&);
void remove_route (TimeAxisView *); void timeaxisview_deleted (TimeAxisView *);
bool route_removal;
Gtk::HBox global_hpacker; Gtk::HBox global_hpacker;
Gtk::VBox global_vpacker; Gtk::VBox global_vpacker;
@ -1803,9 +1802,7 @@ public:
bool show_editor_mixer_when_tracks_arrive; bool show_editor_mixer_when_tracks_arrive;
Gtk::VBox current_mixer_strip_vbox; Gtk::VBox current_mixer_strip_vbox;
void cms_new (boost::shared_ptr<ARDOUR::Route>); void cms_new (boost::shared_ptr<ARDOUR::Route>);
void cms_deleted ();
void current_mixer_strip_hidden (); void current_mixer_strip_hidden ();
void current_mixer_strip_removed ();
void detach_tearoff (Gtk::Box* b, Gtk::Window* w); void detach_tearoff (Gtk::Box* b, Gtk::Window* w);
void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n); void reattach_tearoff (Gtk::Box* b, Gtk::Window* w, int32_t n);

View file

@ -2662,7 +2662,7 @@ RubberbandSelectDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
} }
void void
RubberbandSelectDrag::motion (GdkEvent* event, bool first_move) RubberbandSelectDrag::motion (GdkEvent* event, bool)
{ {
nframes64_t start; nframes64_t start;
nframes64_t end; nframes64_t end;

View file

@ -1088,7 +1088,6 @@ Editor::handle_new_imageframe_time_axis_view(const string & track_name, void* sr
row[route_display_columns.tv] = iftav; row[route_display_columns.tv] = iftav;
route_list_display.get_selection()->select (row); route_list_display.get_selection()->select (row);
iftav->CatchDeletion.connect (*this, boost::bind (&Editor::remove_route, this, (TimeAxisView*)iftav), gui_context());
iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ; iftav->gui_changed.connect(sigc::mem_fun(*this, &Editor::handle_gui_changes)) ;
} }
@ -1104,8 +1103,6 @@ Editor::handle_new_imageframe_marker_time_axis_view(const string & track_name, T
row[route_display_columns.text] = mta->name(); row[route_display_columns.text] = mta->name();
row[route_display_columns.tv] = mta; row[route_display_columns.tv] = mta;
route_list_display.get_selection()->select (row); route_list_display.get_selection()->select (row);
mta->CatchDeletion.connect (*this, boost::bind (&Editor::remove_route, this, (TimeAxisView*)mta), gui_context());
} }

View file

@ -63,12 +63,6 @@ Editor::editor_list_button_toggled ()
} }
} }
void
Editor::cms_deleted ()
{
current_mixer_strip = 0;
}
void void
Editor::show_editor_mixer (bool yn) Editor::show_editor_mixer (bool yn)
{ {
@ -169,7 +163,7 @@ Editor::create_editor_mixer ()
_session, _session,
false); false);
current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden)); current_mixer_strip->Hiding.connect (sigc::mem_fun(*this, &Editor::current_mixer_strip_hidden));
current_mixer_strip->CatchDeletion.connect (*this, boost::bind (&Editor::current_mixer_strip_removed, this), gui_context());
#ifdef GTKOSX #ifdef GTKOSX
current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn)); current_mixer_strip->WidthChanged.connect (sigc::mem_fun(*this, &Editor::ensure_all_elements_drawn));
#endif #endif
@ -296,15 +290,6 @@ Editor::update_current_screen ()
} }
} }
void
Editor::current_mixer_strip_removed ()
{
if (current_mixer_strip) {
/* it is being deleted elsewhere */
current_mixer_strip = 0;
}
}
void void
Editor::current_mixer_strip_hidden () Editor::current_mixer_strip_hidden ()
{ {

View file

@ -81,6 +81,8 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed
// set the initial height of this time axis // set the initial height of this time axis
set_height(hNormal) ; set_height(hNormal) ;
TimeAxisView::CatchDeletion.connect (*this, ui_bind (&ImageFrameTimeAxis::remove_time_axis_view, this, _1), gui_context());
} }
/** /**
@ -322,8 +324,6 @@ ImageFrameTimeAxis::add_marker_time_axis(MarkerTimeAxis* marker_track, void* src
else else
{ {
marker_time_axis_list.push_back(marker_track) ; marker_time_axis_list.push_back(marker_track) ;
marker_track->CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxis::remove_time_axis_view, this, marker_track, (void*)this), gui_context());
MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */ MarkerTimeAxisAdded(marker_track, src) ; /* EMIT_SIGNAL */
ret = true ; ret = true ;
} }
@ -390,16 +390,19 @@ ImageFrameTimeAxis::remove_named_marker_time_axis(const string & track_id, void*
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
void void
ImageFrameTimeAxis::remove_time_axis_view(MarkerTimeAxis* mta, void* src) ImageFrameTimeAxis::remove_time_axis_view (TimeAxisView* tav)
{ {
ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxis::remove_time_axis_view, mta, src) MarkerTimeAxisView* mtav = dynamic_cast<MarkerTimeAxisView*> (tav);
if (!mtav) {
return;
}
MarkerTimeAxisList::iterator i; MarkerTimeAxisList::iterator i;
if((i = find (marker_time_axis_list.begin(), marker_time_axis_list.end(), mta)) != marker_time_axis_list.end())
{ if ((i = find (marker_time_axis_list.begin(), marker_time_axis_list.end(), mta)) != marker_time_axis_list.end()) {
// note that we dont delete the object itself, we just remove it from our list // note that we dont delete the object itself, we just remove it from our list
marker_time_axis_list.erase(i) ; marker_time_axis_list.erase(i) ;
MarkerTimeAxisRemoved (mta->name(), src) ; /* EMIT_SIGNAL */ MarkerTimeAxisRemoved (mta->name(), src) ; /* EMIT_SIGNAL */
} }
} }

View file

@ -138,12 +138,12 @@ class ImageFrameTimeAxis : public VisualTimeAxis
MarkerTimeAxis* remove_named_marker_time_axis(const std::string & track_id, void* src) ; MarkerTimeAxis* remove_named_marker_time_axis(const std::string & track_id, void* src) ;
/** /**
* Removes tav from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis * Potentially removes a MarkerTimeAxisView from the list of MarkerTimaAxis associated with this ImageFrameTimeAxis
* *
* @param tav the TimeAxis to remove * @param tav the TimeAxis to remove
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
void remove_time_axis_view(MarkerTimeAxis* tav, void* src) ; void remove_time_axis_view (TimeAxisView* av);
//---------------------------------------------------------------------------------------// //---------------------------------------------------------------------------------------//

View file

@ -51,6 +51,8 @@ ImageFrameTimeAxisGroup::ImageFrameTimeAxisGroup(ImageFrameTimeAxisView& iftav,
{ {
selected_imageframe_item = 0; selected_imageframe_item = 0;
is_selected = false; is_selected = false;
ImageFrameView::CatchDeletion.connect (*this, ui_bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, _1), gui_context());
} }
/** /**
@ -217,9 +219,6 @@ ImageFrameTimeAxisGroup::add_imageframe_item(const string & frame_id, nframes_t
num_channels); num_channels);
imageframe_views.push_front(ifv); imageframe_views.push_front(ifv);
ifv->CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxisGroup::remove_imageframe_item, this, (void*)this), gui_context());
ImageFrameAdded(ifv, src); /* EMIT_SIGNAL */ ImageFrameAdded(ifv, src); /* EMIT_SIGNAL */
} }
@ -330,13 +329,13 @@ ImageFrameTimeAxisGroup::remove_named_imageframe_item(const string & frame_id, v
* @param ifv the ImageFrameView to remove * @param ifv the ImageFrameView to remove
*/ */
void void
ImageFrameTimeAxisGroup::remove_imageframe_item(ImageFrameView* ifv, void* src) ImageFrameTimeAxisGroup::remove_imageframe_item (ImageFrameView* ifv)
{ {
ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxisGroup::remove_imageframe_item, ifv, src) ENSURE_GUI_THREAD (*this, &ImageFrameTimeAxisGroup::remove_imageframe_item, ifv, src)
ImageFrameViewList::iterator i; ImageFrameViewList::iterator i;
if((i = find (imageframe_views.begin(), imageframe_views.end(), ifv)) != imageframe_views.end())
{ if((i = find (imageframe_views.begin(), imageframe_views.end(), ifv)) != imageframe_views.end()) {
imageframe_views.erase(i); imageframe_views.erase(i);
std::string frame_id = ifv->get_item_name(); std::string frame_id = ifv->get_item_name();

View file

@ -66,6 +66,8 @@ ImageFrameTimeAxisView::ImageFrameTimeAxisView (ImageFrameTimeAxis& tv)
selected_imageframe_group = 0 ; selected_imageframe_group = 0 ;
selected_imageframe_view = 0 ; selected_imageframe_view = 0 ;
ImageFrameTimeAxisGroup::CatchDeletion.connect (*this, ui_bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, _1), gui_context());
} }
/** /**
@ -211,11 +213,7 @@ ImageFrameTimeAxisView::add_imageframe_group(std::string group_id, void* src)
else else
{ {
iftag = new ImageFrameTimeAxisGroup(*this, group_id) ; iftag = new ImageFrameTimeAxisGroup(*this, group_id) ;
imageframe_groups.push_front(iftag) ; imageframe_groups.push_front(iftag) ;
iftag->CatchDeletion.connect (*this, boost::bind (&ImageFrameTimeAxisView::remove_imageframe_group, this, iftag, (void*)this), gui_context());
ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */ ImageFrameGroupAdded(iftag, src) ; /* EMIT_SIGNAL */
} }

View file

@ -103,6 +103,8 @@ ImageFrameView::ImageFrameView(const string & item_id,
set_position(start, this); set_position(start, this);
set_duration(duration, this); set_duration(duration, this);
MarkerView::CatchDeletion.connect (*this, ui_bind (&ImageFrameView::remove_marker_view_item, this, _1), gui_context());
} }
/** /**
@ -286,9 +288,6 @@ void
ImageFrameView::add_marker_view_item(MarkerView* item, void* src) ImageFrameView::add_marker_view_item(MarkerView* item, void* src)
{ {
marker_view_list.push_back(item); marker_view_list.push_back(item);
item->CatchDeletion.connect (*this, boost::bind (&ImageFrameView::remove_marker_view_item, this, (void*)this), gui_context());
MarkerViewAdded(item, src); /* EMIT_SIGNAL */ MarkerViewAdded(item, src); /* EMIT_SIGNAL */
} }
@ -335,7 +334,7 @@ ImageFrameView::remove_named_marker_view_item(const string & markerId, void* src
* @param src the identity of the object that initiated the change * @param src the identity of the object that initiated the change
*/ */
void void
ImageFrameView::remove_marker_view_item(MarkerView* mv, void* src) ImageFrameView::remove_marker_view_item (MarkerView* mv)
{ {
ENSURE_GUI_THREAD (*this, &ImageFrameView::remove_marker_view_item, mv, src) ENSURE_GUI_THREAD (*this, &ImageFrameView::remove_marker_view_item, mv, src)

View file

@ -67,6 +67,7 @@ MarkerTimeAxisView::MarkerTimeAxisView(MarkerTimeAxis& tv)
_samples_per_unit = _trackview.editor.get_current_zoom() ; _samples_per_unit = _trackview.editor.get_current_zoom() ;
_trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit)); _trackview.editor.ZoomChanged.connect (sigc::mem_fun(*this, &MarkerTimeAxisView::reset_samples_per_unit));
MarkerView::CatchDeletion.connect (*this, ui_bind (&MarkerTimeAxisView::remove_marker_view, this, _1), gui_context());
} }
/** /**
@ -211,8 +212,6 @@ MarkerTimeAxisView::add_marker_view(ImageFrameView* ifv, std::string mark_type,
ifv->add_marker_view_item(mv, src) ; ifv->add_marker_view_item(mv, src) ;
marker_view_list.push_front(mv) ; marker_view_list.push_front(mv) ;
mv->CatchDeletion.connect (*this, boost::bind (&MarkerTimeAxisView::remove_marker_view, this, _1), gui_context());
MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */ MarkerViewAdded(mv,src) ; /* EMIT_SIGNAL */
return(mv) ; return(mv) ;
@ -326,7 +325,6 @@ MarkerTimeAxisView::remove_marker_view(MarkerView* mv)
} }
} }
/** /**
* Sets the duration of the selected MarkerView to the specified number of seconds * Sets the duration of the selected MarkerView to the specified number of seconds
* *

View file

@ -1071,7 +1071,7 @@ MidiRegionView::add_ghost (TimeAxisView& tv)
} }
} }
ghost->CatchDeletion.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context()); GhostRegion::CatchDeletion.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
return ghost; return ghost;
} }

View file

@ -72,6 +72,7 @@ using namespace std;
sigc::signal<void,boost::shared_ptr<Route> > MixerStrip::SwitchIO; sigc::signal<void,boost::shared_ptr<Route> > MixerStrip::SwitchIO;
int MixerStrip::scrollbar_height = 0; int MixerStrip::scrollbar_height = 0;
PBD::Signal1<void,MixerStrip*> MixerStrip::CatchDeletion;
MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer) MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer)
: AxisView(sess) : AxisView(sess)

View file

@ -102,6 +102,7 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
sigc::signal<void> WidthChanged; sigc::signal<void> WidthChanged;
static sigc::signal<void,boost::shared_ptr<ARDOUR::Route> > SwitchIO; static sigc::signal<void,boost::shared_ptr<ARDOUR::Route> > SwitchIO;
static PBD::Signal1<void,MixerStrip*> CatchDeletion;
protected: protected:
friend class Mixer_UI; friend class Mixer_UI;

View file

@ -251,6 +251,8 @@ Mixer_UI::Mixer_UI ()
auto_rebinding = FALSE; auto_rebinding = FALSE;
MixerStrip::CatchDeletion.connect (*this, ui_bind (&Mixer_UI::remove_strip, this, _1), gui_context());
_plugin_selector = new PluginSelector (PluginManager::the_manager ()); _plugin_selector = new PluginSelector (PluginManager::the_manager ());
} }
@ -334,7 +336,6 @@ Mixer_UI::add_strip (RouteList& routes)
} }
route->NameChanged.connect (*this, boost::bind (&Mixer_UI::strip_name_changed, this, strip), gui_context()); route->NameChanged.connect (*this, boost::bind (&Mixer_UI::strip_name_changed, this, strip), gui_context());
route->DropReferences.connect (*this, boost::bind (&Mixer_UI::remove_strip, this, strip), gui_context());
strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed)); strip->WidthChanged.connect (sigc::mem_fun(*this, &Mixer_UI::strip_width_changed));
strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip)); strip->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::strip_button_release_event), strip));
@ -350,7 +351,14 @@ Mixer_UI::add_strip (RouteList& routes)
void void
Mixer_UI::remove_strip (MixerStrip* strip) Mixer_UI::remove_strip (MixerStrip* strip)
{ {
ENSURE_GUI_THREAD (*this, &Mixer_UI::remove_strip, strip) if (_session && _session->deletion_in_progress()) {
/* its all being taken care of */
return;
}
ENSURE_GUI_THREAD (*this, &Mixer_UI::remove_strip, strip);
cerr << "Mixer UI removing strip for " << strip << endl;
TreeModel::Children rows = track_model->children(); TreeModel::Children rows = track_model->children();
TreeModel::Children::iterator ri; TreeModel::Children::iterator ri;

View file

@ -80,6 +80,7 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
, wait_for_data(false) , wait_for_data(false)
, _time_converter(r->session().tempo_map(), r->position()) , _time_converter(r->session().tempo_map(), r->position())
{ {
GhostRegion::CatchDeletion.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
} }
RegionView::RegionView (const RegionView& other) RegionView::RegionView (const RegionView& other)
@ -94,6 +95,8 @@ RegionView::RegionView (const RegionView& other)
valid = false; valid = false;
_pixel_width = other._pixel_width; _pixel_width = other._pixel_width;
_height = other._height; _height = other._height;
GhostRegion::CatchDeletion.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
} }
RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other_region) RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other_region)
@ -112,6 +115,8 @@ RegionView::RegionView (const RegionView& other, boost::shared_ptr<Region> other
valid = false; valid = false;
_pixel_width = other._pixel_width; _pixel_width = other._pixel_width;
_height = other._height; _height = other._height;
GhostRegion::CatchDeletion.connect (*this, ui_bind (&RegionView::remove_ghost, this, _1), gui_context());
} }
RegionView::RegionView (ArdourCanvas::Group* parent, RegionView::RegionView (ArdourCanvas::Group* parent,

View file

@ -79,6 +79,9 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt, ARDOUR::Session* sess)
RouteUI::~RouteUI() RouteUI::~RouteUI()
{ {
_route.reset (); /* drop reference to route, so that it can be cleaned up */
route_connections.drop_connections ();
delete solo_menu; delete solo_menu;
delete mute_menu; delete mute_menu;
delete sends_menu; delete sends_menu;
@ -165,9 +168,6 @@ RouteUI::self_delete ()
{ {
/* This may be called from a non-GUI thread. Keep it safe */ /* This may be called from a non-GUI thread. Keep it safe */
cerr << "\n\nExpect to see route " << _route->name() << " be deleted\n";
_route.reset (); /* drop reference to route, so that it can be cleaned up */
route_connections.drop_connections ();
delete_when_idle (this); delete_when_idle (this);
} }

View file

@ -46,6 +46,22 @@ struct AudioRangeComparator {
} }
}; };
Selection::Selection (const PublicEditor* e)
: tracks (e)
, editor (e)
, next_time_id (0)
{
clear ();
/* we have disambiguate which remove() for the compiler */
void (Selection::*track_remove)(TimeAxisView*) = &Selection::remove;
TimeAxisView::CatchDeletion.connect (*this, ui_bind (track_remove, this, _1), gui_context());
void (Selection::*marker_remove)(Marker*) = &Selection::remove;
Marker::CatchDeletion.connect (*this, ui_bind (marker_remove, this, _1), gui_context());
}
#if 0 #if 0
Selection& Selection&
Selection::operator= (const Selection& other) Selection::operator= (const Selection& other)
@ -209,8 +225,6 @@ Selection::toggle (TimeAxisView* track)
TrackSelection::iterator i; TrackSelection::iterator i;
if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) { if ((i = find (tracks.begin(), tracks.end(), track)) == tracks.end()) {
void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
track->CatchDeletion.connect (*this, boost::bind (pmf, this, track), gui_context());
tracks.push_back (track); tracks.push_back (track);
} else { } else {
tracks.erase (i); tracks.erase (i);
@ -337,11 +351,6 @@ Selection::add (const TrackViewList& track_list)
{ {
TrackViewList added = tracks.add (track_list); TrackViewList added = tracks.add (track_list);
for (list<TimeAxisView*>::const_iterator i = added.begin(); i != added.end(); ++i) {
void (Selection::*pmf)(TimeAxisView*) = &Selection::remove;
(*i)->CatchDeletion.connect (*this, boost::bind (pmf, this, (*i)), gui_context());
}
if (!added.empty()) { if (!added.empty()) {
TracksChanged (); TracksChanged ();
} }
@ -945,13 +954,6 @@ void
Selection::add (Marker* m) Selection::add (Marker* m)
{ {
if (find (markers.begin(), markers.end(), m) == markers.end()) { if (find (markers.begin(), markers.end(), m) == markers.end()) {
/* disambiguate which remove() for the compiler */
void (Selection::*pmf)(Marker*) = &Selection::remove;
m->CatchDeletion.connect (*this, boost::bind (pmf, this, _1), gui_context());
markers.push_back (m); markers.push_back (m);
MarkersChanged(); MarkersChanged();
} }

View file

@ -85,9 +85,7 @@ class Selection : public sigc::trackable, public PBD::ScopedConnectionList
MidiRegionSelection midi_regions; MidiRegionSelection midi_regions;
MidiNoteSelection midi_notes; MidiNoteSelection midi_notes;
Selection (PublicEditor const * e) : tracks (e), editor (e), next_time_id (0) { Selection (PublicEditor const * e);
clear();
}
// Selection& operator= (const Selection& other); // Selection& operator= (const Selection& other);

View file

@ -74,6 +74,7 @@ uint32_t TimeAxisView::hSmaller = 0;
uint32_t TimeAxisView::hSmall = 0; uint32_t TimeAxisView::hSmall = 0;
bool TimeAxisView::need_size_info = true; bool TimeAxisView::need_size_info = true;
int const TimeAxisView::_max_order = 512; int const TimeAxisView::_max_order = 512;
PBD::Signal1<void,TimeAxisView*> TimeAxisView::CatchDeletion;
TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/) TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
: AxisView (sess), : AxisView (sess),
@ -178,6 +179,8 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
controls_hbox.show (); controls_hbox.show ();
ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler)); ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler));
GhostRegion::CatchDeletion.connect (*this, ui_bind (&TimeAxisView::erase_ghost, this, _1), gui_context());
} }
TimeAxisView::~TimeAxisView() TimeAxisView::~TimeAxisView()
@ -925,24 +928,23 @@ TimeAxisView::add_ghost (RegionView* rv)
if(gr) { if(gr) {
ghosts.push_back(gr); ghosts.push_back(gr);
gr->CatchDeletion.connect (*this, ui_bind (&TimeAxisView::erase_ghost, this, _1), gui_context());
} }
} }
void void
TimeAxisView::remove_ghost (RegionView* rv) { TimeAxisView::remove_ghost (RegionView* rv)
{
rv->remove_ghost_in (*this); rv->remove_ghost_in (*this);
} }
void void
TimeAxisView::erase_ghost (GhostRegion* gr) { TimeAxisView::erase_ghost (GhostRegion* gr)
{
if (in_destructor) { if (in_destructor) {
return; return;
} }
list<GhostRegion*>::iterator i; for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
for (i = ghosts.begin(); i != ghosts.end(); ++i) {
if ((*i) == gr) { if ((*i) == gr) {
ghosts.erase (i); ghosts.erase (i);
break; break;

View file

@ -96,6 +96,8 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
XMLNode& get_state (); XMLNode& get_state ();
int set_state (const XMLNode&, int version); int set_state (const XMLNode&, int version);
static PBD::Signal1<void,TimeAxisView*> CatchDeletion;
/** @return index of this TimeAxisView within its parent */ /** @return index of this TimeAxisView within its parent */
int order () const { return _order; } int order () const { return _order; }

View file

@ -49,6 +49,7 @@ Butler::Butler(Session& s)
Butler::~Butler() Butler::~Butler()
{ {
terminate_thread ();
} }
int int

View file

@ -362,9 +362,7 @@ Session::destroy ()
Stateful::loading_state_version = 0; Stateful::loading_state_version = 0;
_butler->terminate_thread ();
delete _butler; delete _butler;
delete midi_control_ui; delete midi_control_ui;
if (click_data != default_click) { if (click_data != default_click) {
@ -425,8 +423,9 @@ Session::destroy ()
/* writer goes out of scope and updates master */ /* writer goes out of scope and updates master */
} }
routes.flush (); routes.flush ();
extern void boost_debug_count_ptrs ();
boost_debug_count_ptrs (); boost::shared_ptr<RouteList> r = routes.reader ();
cerr << "\n\n\n AFTER ROUTE CLEARING, there are " << r->size() << " routes in RCU\n";
DEBUG_TRACE (DEBUG::Destruction, "delete diskstreams\n"); DEBUG_TRACE (DEBUG::Destruction, "delete diskstreams\n");
{ {

View file

@ -1104,6 +1104,7 @@ Session::set_state (const XMLNode& node, int version)
XMLNode* child; XMLNode* child;
const XMLProperty* prop; const XMLProperty* prop;
int ret = -1; int ret = -1;
extern void boost_debug_shared_ptr_show_live_debugging (bool);
_state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave); _state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave);

View file

@ -136,13 +136,23 @@ is_interesting_object (void const* ptr)
/* ------------------------------- */ /* ------------------------------- */
static bool debug_out = false;
void
boost_debug_shared_ptr_show_live_debugging (bool yn)
{
debug_out = yn;
}
void void
boost_debug_shared_ptr_mark_interesting (void* ptr, const char* type) boost_debug_shared_ptr_mark_interesting (void* ptr, const char* type)
{ {
Glib::Mutex::Lock guard (the_lock); Glib::Mutex::Lock guard (the_lock);
pair<void*,const char*> newpair (ptr, type); pair<void*,const char*> newpair (ptr, type);
interesting_pointers.insert (newpair); interesting_pointers.insert (newpair);
// cerr << "Interesting object @ " << ptr << " of type " << type << endl; if (debug_out) {
cerr << "Interesting object @ " << ptr << " of type " << type << endl;
}
} }
void void
@ -155,18 +165,23 @@ boost_debug_shared_ptr_operator_equals (void const *sp, void const *old_obj, int
Glib::Mutex::Lock guard (the_lock); Glib::Mutex::Lock guard (the_lock);
if (is_interesting_object (old_obj) || is_interesting_object (obj)) { if (is_interesting_object (old_obj) || is_interesting_object (obj)) {
// cerr << "ASSIGN SWAPS " << old_obj << " & " << obj << endl; if (debug_out) {
cerr << "ASSIGN SWAPS " << old_obj << " & " << obj << endl;
}
} }
if (is_interesting_object (old_obj)) { if (is_interesting_object (old_obj)) {
// cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count if (debug_out) {
// << " (total sp's = " << sptrs.size() << ')' << endl; cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count
<< " (total sp's = " << sptrs.size() << ')' << endl;
}
PointerMap::iterator x = sptrs.find (sp); PointerMap::iterator x = sptrs.find (sp);
if (x != sptrs.end()) { if (x != sptrs.end()) {
sptrs.erase (x); sptrs.erase (x);
// cerr << "\tRemoved (by assigment) sp for " << old_obj << " @ " << sp << " UC = " << old_use_count << " (total sp's = " << sptrs.size() << ')' << endl; if (debug_out) {
cerr << "\tRemoved (by assigment) sp for " << old_obj << " @ " << sp << " UC = " << old_use_count << " (total sp's = " << sptrs.size() << ')' << endl;
}
} }
} }
@ -179,10 +194,12 @@ boost_debug_shared_ptr_operator_equals (void const *sp, void const *old_obj, int
sptrs.insert (newpair); sptrs.insert (newpair);
// cerr << "assignment created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count if (debug_out) {
// << " UC = " << new_use_count cerr << "assignment created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count
// << " (total sp's = " << sptrs.size() << ')' << endl; << " UC = " << new_use_count
<< " (total sp's = " << sptrs.size() << ')' << endl;
cerr << *newpair.second << endl;
}
} }
} }
@ -190,7 +207,9 @@ void
boost_debug_shared_ptr_reset (void const *sp, void const *obj, int use_count) boost_debug_shared_ptr_reset (void const *sp, void const *obj, int use_count)
{ {
if (is_interesting_object (obj)) { if (is_interesting_object (obj)) {
// cerr << "reset sp to object @ " << obj << " @ " << sp << " UC was " << use_count << " (total sp's = " << sptrs.size() << ')' << endl; if (debug_out) {
cerr << "reset sp to object @ " << obj << " @ " << sp << " UC was " << use_count << " (total sp's = " << sptrs.size() << ')' << endl;
}
} }
} }
@ -202,7 +221,9 @@ boost_debug_shared_ptr_destructor (void const *sp, void const *obj, int use_coun
if (x != sptrs.end()) { if (x != sptrs.end()) {
sptrs.erase (x); sptrs.erase (x);
// cerr << "Removed sp for " << obj << " @ " << sp << " UC = " << use_count << " (total sp's = " << sptrs.size() << ')' << endl; if (debug_out) {
cerr << "Removed sp for " << obj << " @ " << sp << " UC = " << use_count << " (total sp's = " << sptrs.size() << ')' << endl;
}
} }
} }
@ -217,7 +238,10 @@ boost_debug_shared_ptr_constructor (void const *sp, void const *obj, int use_cou
newpair.second = new SPDebug (new Backtrace()); newpair.second = new SPDebug (new Backtrace());
sptrs.insert (newpair); sptrs.insert (newpair);
// cerr << "Stored constructor for " << obj << " @ " << sp << " UC = " << use_count << " (total sp's = " << sptrs.size() << ')' << endl; if (debug_out) {
cerr << "Stored constructor for " << obj << " @ " << sp << " UC = " << use_count << " (total sp's = " << sptrs.size() << ')' << endl;
cerr << *newpair.second << endl;
}
} }
} }