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

Daniel Burrows dburrows at costa.debian.org
Mon Aug 8 23:00:34 UTC 2005


Author: dburrows
Date: Mon Aug  8 23:00:31 2005
New Revision: 3762

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/vscreen/vs_menubar.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_minibuf_win.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc
   branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc
Log:
When removing widgets from a container, blank their 'owner' field;
testvscreen runs again now!

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Mon Aug  8 23:00:31 2005
@@ -1,5 +1,12 @@
 2005-08-08  Daniel Burrows  <dburrows at debian.org>
 
+	* src/vscreen/vs_menubar.cc, src/vscreen/vs_minibuf.cc, src/vscree/vs_stacked.cc, src/vscreen/vs_table.cc:
+
+	  Make sure that we explicitly zero out the "owner" field of
+	  widgets that are removed from these containers.  This has the
+	  useful side effect of causing the Curses windows to be
+	  invalidated and hence making the assertion(!win) succeed.
+
 	* src/vscreen/vs_radiogroup.cc:
 
 	  Fix a thinko: when we're removing the last button in a radio

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_menubar.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_menubar.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_menubar.cc	Mon Aug  8 23:00:31 2005
@@ -200,6 +200,8 @@
       assert(found);
 
       active_menus.remove(w2);
+
+      w2->set_owner(NULL);
     }
 }
 

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_minibuf_win.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_minibuf_win.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_minibuf_win.cc	Mon Aug  8 23:00:31 2005
@@ -91,9 +91,11 @@
 {
   int w=0;
 
-  w=max(w, status->width_request());
+  if(status.valid())
+    w=max(w, status->width_request());
 
-  w=max(w, header->width_request());
+  if(header.valid())
+    w=max(w, header->width_request());
 
   if(main_widget.valid())
     w=max(w, main_widget->width_request());
@@ -112,14 +114,16 @@
 
 void vs_minibuf_win::layout_me()
 {
-  header->alloc_size(0, 0, getmaxx(), 1);
+  if(header.valid())
+    header->alloc_size(0, 0, getmaxx(), 1);
 
   if(getmaxy()>1)
     {
       if(getmaxy()>2 && main_widget.valid())
 	main_widget->alloc_size(0, 1, getmaxx(), getmaxy()-2);
 
-      status->alloc_size(0, getmaxy()-1, getmaxx(), 1);
+      if(status.valid())
+	status->alloc_size(0, getmaxy()-1, getmaxx(), 1);
     }
 }
 
@@ -128,8 +132,10 @@
   if(main_widget.valid() && main_widget->get_visible())
     main_widget->display(st);
 
-  status->display(st);
-  header->display(st);
+  if(status.valid())
+    status->display(st);
+  if(header.valid())
+    header->display(st);
 }
 
 void vs_minibuf_win::set_header(string new_header)
@@ -151,12 +157,23 @@
 
 void vs_minibuf_win::rem_widget(const vs_widget_ref &widget)
 {
+  assert(widget.valid());
+
   if(widget == header)
-    header = NULL;
+    {
+      header->set_owner(NULL);
+      header = NULL;
+    }
   else if(widget == status)
-    status = NULL;
+    {
+      status->set_owner(NULL);
+      status = NULL;
+    }
   else if(widget == main_widget)
-    main_widget = NULL;
+    {
+      main_widget->set_owner(NULL);
+      main_widget = NULL;
+    }
   else
     {
       defocus();
@@ -175,7 +192,7 @@
 
 vs_widget_ref vs_minibuf_win::get_focus()
 {
-  if(status->focus_me())
+  if(status.valid() && status->focus_me())
     return status;
   else if(main_widget.valid() && main_widget->get_visible() && main_widget->focus_me())
     return main_widget;

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_stacked.cc	Mon Aug  8 23:00:31 2005
@@ -47,8 +47,10 @@
   vscreen_update();
 }
 
-void vs_stacked::rem_widget(const vs_widget_ref &w)
+void vs_stacked::rem_widget(const vs_widget_ref &wBare)
 {
+  vs_widget_ref w(wBare);
+
   for(childlist::iterator i=children.begin();
       i!=children.end();
       i++)

Modified: branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/vscreen/vs_table.cc	Mon Aug  8 23:00:31 2005
@@ -236,8 +236,10 @@
   num_cols=num_cols;
 }
 
-void vs_table::rem_widget(const vs_widget_ref &w)
+void vs_table::rem_widget(const vs_widget_ref &wBare)
 {
+  vs_widget_ref w = wBare;
+
   for(childlist::iterator i = children.begin(); i != children.end(); ++i)
     if(i->w == w)
       {



More information about the Aptitude-svn-commit mailing list