[Aptitude-devel] r3161 - in branches/aptitude-0.3/aptitude: . src src/generic
Daniel Burrows
dburrows@costa.debian.org
Thu, 28 Apr 2005 01:06:05 +0000
Author: dburrows
Date: Thu Apr 28 01:06:00 2005
New Revision: 3161
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/apt.cc
branches/aptitude-0.3/aptitude/src/generic/apt.h
branches/aptitude-0.3/aptitude/src/ui.cc
Log:
Add an important layer of indirection.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Thu Apr 28 01:06:00 2005
@@ -1,5 +1,12 @@
2005-04-27 Daniel Burrows <dburrows@debian.org>
+ * src/generic/apt.cc, src/generic/apt.h, src/ui.cc:
+
+ Add a layer of indirection (a signal) between the request to
+ clear the error list and the clearing of the error list. Among
+ other things, this means that the command-line no longer
+ segfaults when errors occur.
+
* src/ui.cc:
Use the new support in vs_text_layout to not open tons of
Modified: branches/aptitude-0.3/aptitude/src/generic/apt.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt.cc (original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt.cc Thu Apr 28 01:06:00 2005
@@ -62,6 +62,7 @@
sigc::signal0<void> cache_closed, cache_reloaded, cache_reload_failed;
sigc::signal0<void> hier_reloaded;
+sigc::signal0<void> consume_errors;
static void reload_user_pkg_hier()
{
@@ -180,10 +181,6 @@
apt_reload_cache(progress_bar, do_initselections, status_fname);
}
-// HACK: this is declared in the UI layer, and should be abstracted
-// via, eg, a signal emission (ewww).
-void check_apt_errors();
-
void apt_reload_cache(OpProgress *progress_bar, bool do_initselections,
const char * status_fname)
{
@@ -221,7 +218,7 @@
if(open_failed && getuid()==0)
{
// Don't discard errors, make sure they get displayed instead.
- check_apt_errors();
+ consume_errors();
open_failed=!new_file->Open(*progress_bar, do_initselections,
false, status_fname);
Modified: branches/aptitude-0.3/aptitude/src/generic/apt.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/apt.h (original)
+++ branches/aptitude-0.3/aptitude/src/generic/apt.h Thu Apr 28 01:06:00 2005
@@ -1,6 +1,6 @@
// apt.h -*-c++-*-
//
-// Copyright 1999,2000,2001 Daniel Burrows
+// Copyright 1999-2002, 2004-2005 Daniel Burrows
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -88,6 +88,13 @@
extern sigc::signal0<void> cache_reload_failed;
// Announces that reloading the cache failed.
+/** Called when the UI should display and remove all pending errors
+ * from the queue. It is incumbent on the UI to remove errors on its
+ * own after calling APT routines -- this just indicates that some
+ * errors might need to be removed while a routine is executing.
+ */
+extern sigc::signal0<void> consume_errors;
+
void apt_dumpcfg(const char *root);
// Dumps a subtree of the configuration to ~/.aptitude/config
Modified: branches/aptitude-0.3/aptitude/src/ui.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/ui.cc (original)
+++ branches/aptitude-0.3/aptitude/src/ui.cc Thu Apr 28 01:06:00 2005
@@ -1609,6 +1609,8 @@
// display.
package_states_changed.connect(sigc::ptr_fun(vscreen_update));
+ consume_errors.connect(sigc::ptr_fun(check_apt_errors));
+
if(aptcfg->Exists(PACKAGE "::Theme"))
load_options(PACKAGE "::Themes::"+string(aptcfg->Find(PACKAGE "::Theme"))+"::"+PACKAGE "::UI", true);