summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-01-20 11:48:59 +0100
committerRobin Gareus <robin@gareus.org>2017-01-20 13:53:37 +0100
commit1d2a76f23984205f3717980ed3b8134f0be17bd7 (patch)
tree7218d09bcfdff0cab2aa3dce25d6bcf6a99ffa1b
parenta8afe7faab10609ab67d7cd9d11059ea48f3b3bd (diff)
Free some one time alloc of the UI (cleaner valgrind output)
No incremental leaks here.. * downcase (const char*) uses strdup, caller needs to free * free allocated cursors when the editor is destroyed * drop static editor lua-instance & bindings * delete allocated gtk image/icons
-rw-r--r--gtk2_ardour/ardour_ui.cc3
-rw-r--r--gtk2_ardour/editor.cc11
-rw-r--r--gtk2_ardour/luainstance.cc7
-rw-r--r--gtk2_ardour/luainstance.h1
-rw-r--r--gtk2_ardour/mouse_cursors.cc5
-rw-r--r--gtk2_ardour/mouse_cursors.h1
-rw-r--r--gtk2_ardour/ui_config.cc2
7 files changed, 28 insertions, 2 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index d9ea44c325..7f5ceeef1d 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -746,6 +746,7 @@ ARDOUR_UI::~ARDOUR_UI ()
delete luawindow; luawindow = 0;
delete editor; editor = 0;
delete mixer; mixer = 0;
+ delete rc_option_editor; rc_option_editor = 0; // failed to wrap object warning
delete nsm; nsm = 0;
delete gui_object_state; gui_object_state = 0;
delete main_window_visibility;
@@ -5566,7 +5567,7 @@ ARDOUR_UI::setup_toplevel_window (Gtk::Window& window, const string& name, void*
}
window.set_title (title.get_string());
- window.set_wmclass (string_compose (X_("%1_%1"), downcase (PROGRAM_NAME), downcase (name)), PROGRAM_NAME);
+ window.set_wmclass (string_compose (X_("%1_%1"), downcase (std::string(PROGRAM_NAME)), downcase (name)), PROGRAM_NAME);
window.set_flags (CAN_FOCUS);
window.add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 880963956f..0809ab61cb 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -890,10 +890,21 @@ Editor::~Editor()
delete _locations;
delete _playlist_selector;
delete _time_info_box;
+ delete selection;
+ delete cut_buffer;
+ delete _cursors;
+
+ LuaInstance::destroy_instance ();
for (list<XMLNode *>::iterator i = selection_op_history.begin(); i != selection_op_history.end(); ++i) {
delete *i;
}
+ for (std::map<ARDOUR::FadeShape, Gtk::Image*>::const_iterator i = _xfade_in_images.begin(); i != _xfade_in_images.end (); ++i) {
+ delete i->second;
+ }
+ for (std::map<ARDOUR::FadeShape, Gtk::Image*>::const_iterator i = _xfade_out_images.begin(); i != _xfade_out_images.end (); ++i) {
+ delete i->second;
+ }
}
XMLNode*
diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc
index 1478f9790b..567347f81e 100644
--- a/gtk2_ardour/luainstance.cc
+++ b/gtk2_ardour/luainstance.cc
@@ -833,6 +833,13 @@ LuaInstance::instance ()
return _instance;
}
+void
+LuaInstance::destroy_instance ()
+{
+ delete _instance;
+ _instance = 0;
+}
+
LuaInstance::LuaInstance ()
{
lua.Print.connect (&_lua_print);
diff --git a/gtk2_ardour/luainstance.h b/gtk2_ardour/luainstance.h
index 4291732097..cad533e753 100644
--- a/gtk2_ardour/luainstance.h
+++ b/gtk2_ardour/luainstance.h
@@ -79,6 +79,7 @@ class LuaInstance : public PBD::ScopedConnectionList, public ARDOUR::SessionHand
{
public:
static LuaInstance* instance();
+ static void destroy_instance();
~LuaInstance();
static void register_classes (lua_State* L);
diff --git a/gtk2_ardour/mouse_cursors.cc b/gtk2_ardour/mouse_cursors.cc
index 68ad19ebb7..afe743a7d3 100644
--- a/gtk2_ardour/mouse_cursors.cc
+++ b/gtk2_ardour/mouse_cursors.cc
@@ -72,6 +72,11 @@ MouseCursors::MouseCursors ()
{
}
+MouseCursors::~MouseCursors ()
+{
+ drop_all ();
+}
+
void
MouseCursors::drop_all ()
{
diff --git a/gtk2_ardour/mouse_cursors.h b/gtk2_ardour/mouse_cursors.h
index 8cd98ac32c..ed29840b68 100644
--- a/gtk2_ardour/mouse_cursors.h
+++ b/gtk2_ardour/mouse_cursors.h
@@ -29,6 +29,7 @@ class MouseCursors
{
public:
MouseCursors ();
+ ~MouseCursors ();
void set_cursor_set (const std::string& name);
std::string cursor_set() const { return _cursor_set; }
diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc
index 024357b266..3b45eb7a70 100644
--- a/gtk2_ardour/ui_config.cc
+++ b/gtk2_ardour/ui_config.cc
@@ -268,7 +268,7 @@ UIConfiguration::color_file_name (bool use_my, bool with_version) const
basename += color_name;
basename += "-";
- basename += downcase(PROGRAM_NAME);
+ basename += downcase(std::string(PROGRAM_NAME));
std::string rev (revision);
std::size_t pos = rev.find_first_of("-");