summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2008-12-12 06:57:38 +0000
committerHans Baier <hansfbaier@googlemail.com>2008-12-12 06:57:38 +0000
commit30daaebaa2d90d6b0e8673143ccc3cacd7bd1753 (patch)
tree802b5cda688c025e0171fe5bb047df197e13d75f
parent6c1f3655156e8a357ee30891301daa6a0ab1b980 (diff)
* fixed memory allocation bugs
* commented out a crash line in ardour_ui2.cc (added a warning message). (I thought, it may be fairly efficient to keep issues as code instead of putting them in the tracker where hardly ever one would notice the needle in the haystack) * forgot to clear two other collections on MidiPatchManager::refresh() git-svn-id: svn://localhost/ardour2/branches/3.0@4312 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour_ui2.cc3
-rw-r--r--gtk2_ardour/canvas-flag.cc28
-rw-r--r--gtk2_ardour/canvas-flag.h2
-rw-r--r--gtk2_ardour/midi_region_view.cc6
-rw-r--r--gtk2_ardour/midi_time_axis.cc2
-rw-r--r--libs/ardour/midi_patch_manager.cc4
6 files changed, 32 insertions, 13 deletions
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<std::string>::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();
}