View Issue Details

IDProjectCategoryView StatusLast Update
0007068ardourbugspublic2016-10-12 19:36
Reporternstewart Assigned To 
PrioritynormalSeveritytweakReproducibilityhave not tried
Status closedResolutionfixed 
OSLinux 
Product Version5.X git (version in description) 
Summary0007068: gtk2_ardour/color_theme_manager has potential (minor) leak
DescriptionAFAICT this only leaks one time, and this patch while fixing the leak doesn't fix the cppcheck warning. But color_theme_manager leaks r on exit.

Current as of: 78fef4a253
See attached patch
TagsNo tags attached.

Activities

nstewart

2016-10-11 15:16

reporter  

0001-Fixes-minor-memory-leak-found-in-color_theme_manager.patch (1,795 bytes)   
From 48e99bf1b07826677e6f8bb404251aafa441f549 Mon Sep 17 00:00:00 2001
From: Nathan Stewart <therealnathanstewart@gmail.com>
Date: Tue, 11 Oct 2016 11:07:17 -0400
Subject: [PATCH] Fixes minor memory leak found in color_theme_manager.cpp:326

---
 gtk2_ardour/color_theme_manager.cc | 11 ++++++++++-
 gtk2_ardour/color_theme_manager.h  |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gtk2_ardour/color_theme_manager.cc b/gtk2_ardour/color_theme_manager.cc
index be0278e..fc2a823 100644
--- a/gtk2_ardour/color_theme_manager.cc
+++ b/gtk2_ardour/color_theme_manager.cc
@@ -165,6 +165,16 @@ ColorThemeManager::ColorThemeManager ()
 	show_all ();
 }
 
+
+ColorThemeManager::~ColorThemeManager ()
+{
+	if (palette_group) { 
+		palette_group->clear (true);  
+		delete palette_group;
+	}
+}
+
+
 void
 ColorThemeManager::setup_modifiers ()
 {
@@ -311,7 +321,6 @@ ColorThemeManager::build_palette_canvas (ArdourCanvas::Canvas& canvas, ArdourCan
 	for (uint32_t y = 0; y < height - box_size && color_num < color_limit; y += box_size) {
 		for (uint32_t x = 0; x < width - box_size && color_num < color_limit; x += box_size) {
 			ArdourCanvas::Rectangle* r = new ArdourCanvas::Rectangle (&group, ArdourCanvas::Rect (x, y, x + box_size, y + box_size));
-
 			string name = nc[color_num++].name;
 
 			UIConfiguration::Colors::iterator c = colors.find (name);
diff --git a/gtk2_ardour/color_theme_manager.h b/gtk2_ardour/color_theme_manager.h
index f3e9132..8575939 100644
--- a/gtk2_ardour/color_theme_manager.h
+++ b/gtk2_ardour/color_theme_manager.h
@@ -43,6 +43,7 @@ class ColorThemeManager : public Gtk::VBox, public OptionEditorComponent
 {
   public:
 	ColorThemeManager();
+	~ColorThemeManager();
 
 	void reset_canvas_colors();
 	void on_color_theme_changed ();
-- 
2.7.4

Issue History

Date Modified Username Field Change
2016-10-11 15:16 nstewart New Issue
2016-10-11 15:16 nstewart File Added: 0001-Fixes-minor-memory-leak-found-in-color_theme_manager.patch
2016-10-12 19:36 nstewart Status new => closed
2016-10-12 19:36 nstewart Resolution open => fixed