summaryrefslogtreecommitdiff
path: root/gtk2_ardour/canvas-flag.cc
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 /gtk2_ardour/canvas-flag.cc
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
Diffstat (limited to 'gtk2_ardour/canvas-flag.cc')
-rw-r--r--gtk2_ardour/canvas-flag.cc28
1 files changed, 20 insertions, 8 deletions
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();
}