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

Daniel Burrows dburrows at costa.debian.org
Mon Sep 26 21:33:13 UTC 2005


Author: dburrows
Date: Mon Sep 26 21:33:07 2005
New Revision: 4298

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/broken_indicator.cc
Log:
Don't segfault if the apt cache fails to initialize.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Sep 26 21:33:07 2005
@@ -1,5 +1,13 @@
 2005-09-26  Daniel Burrows  <dburrows at debian.org>
 
+	* src/broken_indicator.cc:
+
+	  Don't segfault if the apt cache is NULL (e.g., if apt_init
+	  failed).  (Closes: #290408) -- at least for the time being; the
+	  general problem is that I need to remember to test the program
+	  in situations where the apt cache fails to initialize due to,
+	  say, invalid configuration files.
+
 	* src/generic/apt/aptcache.cc:
 
 	  Fix the code that sets packages back to manual mode on a keep or

Modified: branches/aptitude-0.3/aptitude/src/broken_indicator.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/broken_indicator.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/broken_indicator.cc	Mon Sep 26 21:33:07 2005
@@ -73,7 +73,7 @@
 
   void handle_cache_reload()
   {
-    if(apt_cache_file)
+    if(resman != NULL)
       resman->state_changed.connect(sigc::mem_fun(*this, &broken_indicator::post_update));
 
     update();
@@ -83,7 +83,7 @@
   broken_indicator()
     :spin_count(0)
   {
-    if(apt_cache_file)
+    if(resman != NULL)
       resman->state_changed.connect(sigc::mem_fun(*this, &broken_indicator::post_update));
 
     cache_closed.connect(sigc::mem_fun(*this, &broken_indicator::update));
@@ -142,7 +142,7 @@
   {
     vs_widget_ref tmpref(this);
 
-    if(resman->background_thread_active())
+    if(resman != NULL && resman->background_thread_active())
       {
  	++spin_count;
 	update();
@@ -210,7 +210,7 @@
   {
     vs_widget_ref tmpref(this);
 
-    if((!apt_cache_file) || !resman->resolver_exists())
+    if(resman == NULL || !resman->resolver_exists())
       {
 	set_fragment(fragf(""));
 	last_sol.nullify();



More information about the Aptitude-svn-commit mailing list