[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r1241: Clear the mapping of keyid-to-RouterListItem when we clear o (trunk/src/gui/network)



Author: edmanm
Date: 2006-09-25 20:42:21 -0400 (Mon, 25 Sep 2006)
New Revision: 1241

Modified:
   trunk/src/gui/network/netviewer.cpp
   trunk/src/gui/network/routerlistwidget.cpp
   trunk/src/gui/network/routerlistwidget.h
Log:
Clear the mapping of keyid-to-RouterListItem when we clear our
RouterListWidget. Previously, if the list was cleared between a geoip resolve
request and response, we would look up a pointer to a RouterListItem that no
longer existed and crash on arma. :(


Modified: trunk/src/gui/network/netviewer.cpp
===================================================================
--- trunk/src/gui/network/netviewer.cpp	2006-09-25 22:18:12 UTC (rev 1240)
+++ trunk/src/gui/network/netviewer.cpp	2006-09-26 00:42:21 UTC (rev 1241)
@@ -178,9 +178,14 @@
 void
 NetViewer::clear()
 {
+  /* Clear the resolve queue and map */
+  _resolveMap.clear();
+  _resolveQueue.clear();
+  /* Clear the network map */
   _map->clear();
   _map->update();
-  ui.treeRouterList->clear();
+  /* Clear the lists of routers, circuits, and streams */
+  ui.treeRouterList->clearRouters();
   ui.treeCircuitList->clear();
   ui.textRouterInfo->clear();
 }

Modified: trunk/src/gui/network/routerlistwidget.cpp
===================================================================
--- trunk/src/gui/network/routerlistwidget.cpp	2006-09-25 22:18:12 UTC (rev 1240)
+++ trunk/src/gui/network/routerlistwidget.cpp	2006-09-26 00:42:21 UTC (rev 1241)
@@ -58,6 +58,14 @@
   }
 }
 
+/** Clear the list of router items. */
+void
+RouterListWidget::clearRouters()
+{
+  _idmap.clear();
+  QTreeWidget::clear();
+}
+
 /** Inserts a new router list item into the list, in its proper sorted place
  * according to the current sort column. */
 void

Modified: trunk/src/gui/network/routerlistwidget.h
===================================================================
--- trunk/src/gui/network/routerlistwidget.h	2006-09-25 22:18:12 UTC (rev 1240)
+++ trunk/src/gui/network/routerlistwidget.h	2006-09-26 00:42:21 UTC (rev 1241)
@@ -72,6 +72,10 @@
   /** Called when the user selects a router from the list. */
   void routerSelected(RouterDescriptor rd);
 
+public slots:
+  /** Clears the list of router items. */
+  void clearRouters();
+  
 private slots:
   /** Called when the user clicks on an item in the list. */
   void onSelectionChanged();