[Aptitude-svn-commit] r4325 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows at costa.debian.org
Wed Sep 28 04:38:49 UTC 2005


Author: dburrows
Date: Wed Sep 28 04:38:46 2005
New Revision: 4325

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/view_changelog.cc
Log:
Destroy the changelog object as early as possible.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Sep 28 04:38:46 2005
@@ -1,5 +1,12 @@
 2005-09-27  Daniel Burrows  <dburrows at debian.org>
 
+	* src/view_changelog.cc:
+
+	  Since the changelog pager reads in the whole changelog when it's
+	  constructed, it no longer needs to ensure that the changelog
+	  file (object) exists as long as the pager does; delete the file
+	  object as soon as we finish reading it.
+
 	* src/generic/util/exception.h:
 
 	  Update the exception documentation to match reality.

Modified: branches/aptitude-0.3/aptitude/src/view_changelog.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/view_changelog.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/view_changelog.cc	Wed Sep 28 04:38:46 2005
@@ -39,10 +39,8 @@
 
 class pkg_changelog_screen : public vs_file_pager, public menu_redirect
 {
-  pkg_changelog *cl;
   bool last_search_forwards;
 
-
   void do_search()
   {
     last_search_forwards = true;
@@ -77,7 +75,7 @@
 
 protected:
   pkg_changelog_screen(pkg_changelog *_cl, int x=0, int y=0, int width=0, int height=0):
-    vs_file_pager(_cl->get_filename()), cl(_cl), last_search_forwards(true)
+    vs_file_pager(_cl->get_filename()), last_search_forwards(true)
   {
     connect_key("Search", &global_bindings,
 		sigc::mem_fun(*this, &pkg_changelog_screen::do_search));
@@ -130,8 +128,6 @@
     do_repeat_search();
     return true;
   }
-
-  virtual ~pkg_changelog_screen() {delete cl;}
 };
 
 typedef ref_ptr<pkg_changelog_screen> pkg_changelog_screen_ref;
@@ -163,7 +159,7 @@
   pkg_changelog *cl=get_changelog(ver, widget,
 				  aptcfg->FindI(PACKAGE "::UI::Download-Poll-Interval", 50000));
   widget->Complete();
-  if(cl)
+  if(cl != NULL)
     {
       char buf[512];
       snprintf(buf, 512, _("ChangeLog of %s"), ver.ParentPkg().Name());
@@ -172,6 +168,7 @@
       string tablabel(buf);
 
       pkg_changelog_screen_ref cs=pkg_changelog_screen::create(cl);
+      delete cl;
       vs_table_ref t=vs_table::create();
       vs_scrollbar_ref s=vs_scrollbar::create(vs_scrollbar::VERTICAL);
 



More information about the Aptitude-svn-commit mailing list