diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 47218e518b..d294df8036 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -877,7 +877,8 @@ ARDOUR_UI::editor_realized () set_size_request_to_display_given_text (speed_display_box, _("-0.55"), 2, 2); const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10); - reset_dpi(); + cerr << "I commented out line line 881 in ardour_ui2.cc, because it made ardour crash somewhere in Gnome::Canvas::Text" << endl; + //reset_dpi(); } void diff --git a/gtk2_ardour/canvas-flag.cc b/gtk2_ardour/canvas-flag.cc index 232035e4cf..c40bf45648 100644 --- a/gtk2_ardour/canvas-flag.cc +++ b/gtk2_ardour/canvas-flag.cc @@ -5,16 +5,32 @@ using namespace Gnome::Canvas; using namespace std; - + void -CanvasFlag::set_text(string& a_text) +CanvasFlag::delete_allocated_objects() { if (_text) { delete _text; _text = 0; } - _text = new Text(*this, 0.0, 0.0, a_text); + if (_line) { + delete _line; + _line = 0; + } + + if (_rect) { + delete _rect; + _rect = 0; + } +} + +void +CanvasFlag::set_text(string& a_text) +{ + delete_allocated_objects(); + + _text = new Text(*this, 0.0, 0.0, Glib::ustring(a_text)); _text->property_justification() = Gtk::JUSTIFY_CENTER; _text->property_fill_color_rgba() = _outline_color_rgba; double flagwidth = _text->property_text_width() + 10.0; @@ -33,10 +49,6 @@ CanvasFlag::set_text(string& a_text) CanvasFlag::~CanvasFlag() { - delete _line; - delete _rect; - if(_text) { - delete _text; - } + delete_allocated_objects(); } diff --git a/gtk2_ardour/canvas-flag.h b/gtk2_ardour/canvas-flag.h index eb50798e8e..23fba78fee 100644 --- a/gtk2_ardour/canvas-flag.h +++ b/gtk2_ardour/canvas-flag.h @@ -47,6 +47,8 @@ protected: guint _fill_color_rgba; private: + void delete_allocated_objects(); + MidiRegionView& _region; SimpleLine* _line; SimpleRect* _rect; diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 5cd1f64127..6063667210 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -658,7 +658,7 @@ MidiRegionView::find_and_insert_program_change_flags() lsb = uint8_t(lsb_control->get_float(true, event_time)); } - //cerr << " got msb " << int(msb) << " and lsb " << int(lsb) << endl; + cerr << " got msb " << int(msb) << " and lsb " << int(lsb) << " thread_id: " << pthread_self() << endl; patch = master_device->find_patch( _custom_device_mode, @@ -668,9 +668,9 @@ MidiRegionView::find_and_insert_program_change_flags() uint8_t(program_number) ); - //cerr << " got patch with name " << patch.name() << " number " << patch.number() << endl; } if (patch != 0) { + cerr << " got patch with name " << patch->name() << " number " << patch->number() << endl; add_pgm_change(event_time, patch->name()); } else { char buf[4]; @@ -1000,7 +1000,7 @@ MidiRegionView::add_pgm_change(nframes_t time, string displaytext) { assert(time >= 0); - // dont display notes beyond the region bounds + // dont display program changes beyond the region bounds if (time - _region->start() >= _region->length() || time < _region->start()) return; diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index a8f6e3a6f4..47733f9efb 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -195,7 +195,7 @@ void MidiTimeAxisView::model_changed() _custom_device_mode_selector.clear_items(); for (std::list::const_iterator i = device_modes.begin(); i != device_modes.end(); ++i) { - cerr << "found custom device mode " << *i << endl; + cerr << "found custom device mode " << *i << " thread_id: " << pthread_self() << endl; _custom_device_mode_selector.append_text(*i); } diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc index bb57f4b10f..cb1ba771f4 100644 --- a/libs/ardour/midi_patch_manager.cc +++ b/libs/ardour/midi_patch_manager.cc @@ -50,6 +50,8 @@ void MidiPatchManager::refresh() { _documents.clear(); + _master_devices_by_model.clear(); + _all_models.clear(); path path_to_patches = _session->session_directory().midi_patch_path(); @@ -97,4 +99,6 @@ MidiPatchManager::drop_session () { _session = 0; _documents.clear(); + _master_devices_by_model.clear(); + _all_models.clear(); }