From fbb9cff8ee3449ecaec31633cad01a2dd1ccc54e Mon Sep 17 00:00:00 2001 From: ffsup2 Date: Tue, 7 Jun 2011 20:12:01 +0200 Subject: [PATCH] Fix for some memory leaks issue #657 --- rtengine/bilateral2.h | 1 + rtengine/imageio.cc | 18 +++++++++++------- rtgui/curveeditor.cc | 6 +++--- rtgui/filecatalog.cc | 2 +- rtgui/filepanel.cc | 10 +++++----- rtgui/popupcommon.cc | 1 + rtgui/popupcommon.h | 2 +- rtgui/saveformatpanel.cc | 8 +++++++- rtgui/saveformatpanel.h | 1 + 9 files changed, 31 insertions(+), 18 deletions(-) diff --git a/rtengine/bilateral2.h b/rtengine/bilateral2.h index 1b5e2ff90..4b28f5f47 100644 --- a/rtengine/bilateral2.h +++ b/rtengine/bilateral2.h @@ -513,6 +513,7 @@ template void bilateral (T** src, T** dst, int W, int H, int sigmar, do delete [] rhist; for (int i=0; iset_tooltip_text(M("CURVEEDITOR_TYPE")); // TODO: Does this signal have to be blocked when on curve type change ? @@ -108,7 +108,7 @@ CurveEditor::CurveEditor (Glib::ustring text, CurveEditorGroup* ceGroup, CurveEd } CurveEditor::~CurveEditor () { - + delete curveType; delete [] histogram; } diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index a3bd606d8..c9fe3c536 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -48,7 +48,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb) : selectedDirectoryId(1) inTabMode=false; // construct and initialize thumbnail browsers - fileBrowser = new FileBrowser(); + fileBrowser = Gtk::manage( new FileBrowser() ); fileBrowser->setFileBrowserListener (this); fileBrowser->setArrangement (ThumbBrowserBase::TB_Vertical); fileBrowser->show (); diff --git a/rtgui/filepanel.cc b/rtgui/filepanel.cc index 80772c618..e20f6ebfa 100644 --- a/rtgui/filepanel.cc +++ b/rtgui/filepanel.cc @@ -36,9 +36,9 @@ FilePanel::FilePanel () : parent(NULL) { dirpaned = Gtk::manage ( new Gtk::HPaned () ); dirpaned->set_position (options.dirBrowserWidth); - dirBrowser = new DirBrowser (); - placesBrowser = new PlacesBrowser (); - recentBrowser = new RecentBrowser (); + dirBrowser = Gtk::manage ( new DirBrowser () ); + placesBrowser = Gtk::manage ( new PlacesBrowser () ); + recentBrowser = Gtk::manage ( new RecentBrowser () ); placespaned = Gtk::manage ( new Gtk::VPaned () ); placespaned->set_size_request(50,100); @@ -54,7 +54,7 @@ FilePanel::FilePanel () : parent(NULL) { dirpaned->pack1 (*placespaned, false, true); tpc = new BatchToolPanelCoordinator (this); - fileCatalog = new FileCatalog (tpc->coarse, tpc->getToolBar()); + fileCatalog = Gtk::manage ( new FileCatalog (tpc->coarse, tpc->getToolBar()) ); ribbonPane = Gtk::manage ( new Gtk::Paned() ); ribbonPane->add(*fileCatalog); ribbonPane->set_size_request(50,150); @@ -72,7 +72,7 @@ FilePanel::FilePanel () : parent(NULL) { rightNotebook = Gtk::manage ( new Gtk::Notebook () ); //Gtk::VBox* taggingBox = Gtk::manage ( new Gtk::VBox () ); - history = new History (false); + history = Gtk::manage ( new History (false) ); tpc->addPParamsChangeListener (history); history->setProfileChangeListener (tpc); diff --git a/rtgui/popupcommon.cc b/rtgui/popupcommon.cc index 1a9a39284..2a1c22654 100644 --- a/rtgui/popupcommon.cc +++ b/rtgui/popupcommon.cc @@ -61,6 +61,7 @@ PopUpCommon::~PopUpCommon () { } if (menu) delete menu; if (buttonImage) delete buttonImage; + delete buttonGroup; } PopUpCommon::type_signal_changed PopUpCommon::signal_changed() { diff --git a/rtgui/popupcommon.h b/rtgui/popupcommon.h index da88f7d35..ef7f47c13 100644 --- a/rtgui/popupcommon.h +++ b/rtgui/popupcommon.h @@ -34,7 +34,7 @@ public: Gtk::HBox* buttonGroup; // this is the widget to be packed PopUpCommon (Gtk::Button* button, const Glib::ustring& label = ""); - ~PopUpCommon (); + virtual ~PopUpCommon (); bool addEntry (Glib::ustring imagePath, Glib::ustring label); bool setSelected (int entryNum); int getSelected () { return selected; } diff --git a/rtgui/saveformatpanel.cc b/rtgui/saveformatpanel.cc index 356fd2cb6..912b4d117 100644 --- a/rtgui/saveformatpanel.cc +++ b/rtgui/saveformatpanel.cc @@ -28,7 +28,7 @@ SaveFormatPanel::SaveFormatPanel () : listener (NULL) { pngcompr = new Adjuster (M("SAVEDLG_PNGCOMPR"), 0, 6, 1, 6); pngcompr->setAdjusterListener (this); pngcompr->show (); - tiffuncompressed = Gtk::manage (new Gtk::CheckButton (M("SAVEDLG_TIFFUNCOMPRESSED"))); + tiffuncompressed = new Gtk::CheckButton (M("SAVEDLG_TIFFUNCOMPRESSED")); tiffuncompressed->signal_toggled().connect( sigc::mem_fun(*this,&SaveFormatPanel::formatChanged)); tiffuncompressed->show(); @@ -64,6 +64,12 @@ SaveFormatPanel::SaveFormatPanel () : listener (NULL) { fstr[3] = "png"; fstr[4] = "png"; } +SaveFormatPanel::~SaveFormatPanel () +{ + delete jpegqual; + delete pngcompr; + delete tiffuncompressed; +} void SaveFormatPanel::init (SaveFormat &sf) { diff --git a/rtgui/saveformatpanel.h b/rtgui/saveformatpanel.h index 50f1473c1..34f6f6309 100644 --- a/rtgui/saveformatpanel.h +++ b/rtgui/saveformatpanel.h @@ -47,6 +47,7 @@ class SaveFormatPanel : public Gtk::VBox, public AdjusterListener { public: SaveFormatPanel (); + ~SaveFormatPanel (); void setListener (FormatChangeListener* l) { listener = l; } void init (SaveFormat& sf);