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

Daniel Burrows dburrows at costa.debian.org
Mon Aug 8 18:09:23 UTC 2005


Author: dburrows
Date: Mon Aug  8 18:09:19 2005
New Revision: 3746

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/pkg_tree.cc
   branches/aptitude-0.3/aptitude/src/pkg_tree.h
Log:
Update pkg_tree for refcounting.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Aug  8 18:09:19 2005
@@ -1,5 +1,9 @@
 2005-08-08  Daniel Burrows  <dburrows at debian.org>
 
+	* src/pkg_tree.cc, src/pkg_tree.h:
+
+	  Update pkg_tree for refcounting.
+
 	* src/edit_pkg_hier.h:
 
 	  Whoops, make ::create() static.

Modified: branches/aptitude-0.3/aptitude/src/pkg_tree.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_tree.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_tree.cc	Mon Aug  8 18:09:19 2005
@@ -625,8 +625,8 @@
 
 bool pkg_tree::build_tree()
 {
-  vs_progress *p=gen_progress_bar();
-  bool rval=build_tree(*p);
+  vs_progress_ref p=gen_progress_bar();
+  bool rval=build_tree(*p.unsafe_get_ref());
   p->destroy();
 
   return rval;

Modified: branches/aptitude-0.3/aptitude/src/pkg_tree.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/pkg_tree.h	(original)
+++ branches/aptitude-0.3/aptitude/src/pkg_tree.h	Mon Aug  8 18:09:19 2005
@@ -77,8 +77,14 @@
    *  performed whenever the root is changed.
    */
   void reset_incsearch();
-public:
+
   pkg_menu_tree();
+public:
+  ref_ptr<pkg_menu_tree> create()
+  {
+    return new pkg_menu_tree;
+  }
+
   ~pkg_menu_tree();
 
   /** \return \b true iff a pkg_node descendant is currently selected. */
@@ -158,6 +164,8 @@
   bool handle_key(const key &k);
 };
 
+typedef ref_ptr<pkg_menu_tree> pkg_menu_tree_ref;
+
 class pkg_tree:public pkg_menu_tree
 {
   /** If \b true, the tree is fully initialized: in particular,
@@ -185,14 +193,25 @@
 
 protected:
   virtual bool handle_key(const key &k);
+
+  pkg_tree(const std::string &groupingstr,
+	   pkg_grouppolicy_factory *_grouping,
+	   const std::wstring &limitstr);
+
+  pkg_tree(const std::string &groupingstr,
+	   pkg_grouppolicy_factory *_grouping);
 public:
   /** Initialize a package tree, but don't build it.  The caller
    *  should call build_tree().  The main reason to do this is so you
    *  can connect up the tree's signals before building it.
    */
-  pkg_tree(const std::string &groupingstr,
-	   pkg_grouppolicy_factory *_grouping,
-	   const std::wstring &limitstr);
+  static ref_ptr<pkg_tree>
+  create(const std::string &groupingstr,
+	 pkg_grouppolicy_factory *grouping,
+	 const std::wstring &limitstr)
+  {
+    return new pkg_tree(groupingstr, grouping, limitstr);
+  }
 
   /** Initialize a package tree, but don't build it.  The caller
    *  should call build_tree().  The main reason to do this is so you
@@ -200,8 +219,12 @@
    *
    *  The default tree limit is used.
    */
-  pkg_tree(const std::string &groupingstr,
-	   pkg_grouppolicy_factory *_grouping);
+  static ref_ptr<pkg_tree>
+  create(const std::string &groupingstr,
+	 pkg_grouppolicy_factory *grouping)
+  {
+    return new pkg_tree(groupingstr, grouping);
+  }
 
   // Should you be able to just pass in a string (?)
   ~pkg_tree();
@@ -252,4 +275,6 @@
   sigc::signal1<void, std::wstring> selected_desc_signal;
 };
 
+typedef ref_ptr<pkg_tree> pkg_tree_ref;
+
 #endif



More information about the Aptitude-svn-commit mailing list