[Aptitude-devel] r3097 - in branches/aptitude-0.3/aptitude: . src/vscreen
Daniel Burrows
dburrows@costa.debian.org
Tue, 26 Apr 2005 15:34:41 +0000
Author: dburrows
Date: Tue Apr 26 15:34:37 2005
New Revision: 3097
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc
branches/aptitude-0.3/aptitude/src/vscreen/vs_table.h
Log:
Close a memory leak.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Tue Apr 26 15:34:37 2005
@@ -1,5 +1,9 @@
2005-04-26 Daniel Burrows <dburrows@debian.org>
+ * src/vscreen/vs_table.cc:
+
+ Fix a memory leak -- vs_tables didn't delete their children.
+
* src/vscreen/fragment.cc:
Slightly fix the way sequence fragments calculate their width.
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc Tue Apr 26 15:34:37 2005
@@ -59,6 +59,14 @@
unfocussed.connect(sigc::mem_fun(*this, &vs_table::lost_focus));
}
+vs_table::~vs_table()
+{
+ // Delete all our children.
+ for(childlist::const_iterator i=children.begin();
+ i!=children.end(); ++i)
+ i->w->set_owner(NULL);
+}
+
void vs_table::set_rowsep(int n)
{
if(n!=rowsep)
Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_table.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_table.h (original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_table.h Tue Apr 26 15:34:37 2005
@@ -145,6 +145,7 @@
bool handle_char(chtype ch);
public:
vs_table();
+ ~vs_table();
void add_widget_opts(vscreen_widget *w, int row_start, int col_start, int row_span, int col_span, int xopts, int yopts);
// eww. C++ overloading is annoying..