[Aptitude-devel] r3133 - in branches/aptitude-0.3/aptitude: . src/vscreen

Daniel Burrows dburrows@costa.debian.org
Wed, 27 Apr 2005 03:15:44 +0000


Author: dburrows
Date: Wed Apr 27 03:15:42 2005
New Revision: 3133

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc
Log:
Fix a memory leak, implement fragment set_text

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Apr 27 03:15:42 2005
@@ -2,6 +2,10 @@
 
 	* src/vscreen/vs_label.cc:
 
+	  Implement the fragment set_text and fix a memory leak.
+
+	* src/vscreen/vs_label.cc:
+
 	  When no attribute is provided, the widget's background is used
 	  to set default text attributes.
 

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_label.cc	Wed Apr 27 03:15:42 2005
@@ -44,9 +44,7 @@
 
 void vs_label::set_text(const string &_txt, int attr)
 {
-  txt=new fragment_cache(text_fragment(_txt, attr));
-  // Our size might have changed, so re-layout the screen.
-  vscreen_queuelayout();
+  set_text(text_fragment(_txt, attr));
 }
 
 void vs_label::set_text(const string &_txt)
@@ -54,6 +52,14 @@
   set_text(_txt, get_bg());
 }
 
+void vs_label::set_text(fragment *f)
+{
+  delete txt;
+  txt=new fragment_cache(f);
+  // Our size might have changed, so re-layout the screen.
+  vscreen_queuelayout();
+}
+
 void vs_label::paint()
 {
   fragment_contents lines=txt->layout(getmaxx(), getmaxx());