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

[tor-commits] [vidalia/alpha] Fix segmentation fault when trying to close an already closed circuit



commit 4c6cf86d215b9a2cd0cbfed7d9769ec8724e5483
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Tue Jun 26 20:07:03 2012 -0300

    Fix segmentation fault when trying to close an already closed circuit
---
 changes/bug6243                           |    3 +++
 src/vidalia/network/CircuitListWidget.cpp |   12 ++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/changes/bug6243 b/changes/bug6243
new file mode 100644
index 0000000..2b51ca5
--- /dev/null
+++ b/changes/bug6243
@@ -0,0 +1,3 @@
+  Bugfixes relative to Vidalia 0.3.x:
+  o Fix segmentation fault when trying to close an already closed circuit in
+  the Network Map. Fixes bug 6243.
diff --git a/src/vidalia/network/CircuitListWidget.cpp b/src/vidalia/network/CircuitListWidget.cpp
index 3871503..4773d9b 100644
--- a/src/vidalia/network/CircuitListWidget.cpp
+++ b/src/vidalia/network/CircuitListWidget.cpp
@@ -79,8 +79,11 @@ CircuitListWidget::customContextMenuRequested(const QPoint &pos)
   if (!item->parent()) {
     /* A circuit was selected */
     CircuitItem *circuitItem = dynamic_cast<CircuitItem *>(item);
-    if (!circuitItem)
+    if (!circuitItem and
+        ((circuitItem->circuit().status() == Circuit::Closed) or
+        (circuitItem->circuit().status() == Circuit::Failed)))
       return;
+    CircuitId id = circuitItem->id();
 
     /* Set up the circuit context menu */
     QAction *zoomAct  = new QAction(QIcon(IMG_ZOOM),
@@ -98,14 +101,15 @@ CircuitListWidget::customContextMenuRequested(const QPoint &pos)
      * selected */
     QAction* action = menu.exec(mapToGlobal(pos));
     if (action == closeAct)
-      emit closeCircuit(circuitItem->id());
+      emit closeCircuit(id);
     else if (action == zoomAct)
-      emit zoomToCircuit(circuitItem->id());
+      emit zoomToCircuit(id);
   } else {
     /* A stream was selected */
     StreamItem *streamItem = dynamic_cast<StreamItem *>(item);
     if (!streamItem)
       return;
+    StreamId id = streamItem->id();
 
     /* Set up the stream context menu */
     QAction *closeAct = new QAction(QIcon(IMG_CLOSE),
@@ -116,7 +120,7 @@ CircuitListWidget::customContextMenuRequested(const QPoint &pos)
      * selected */
     QAction* action = menu.exec(mapToGlobal(pos));
     if (action == closeAct)
-      emit closeStream(streamItem->id());
+      emit closeStream(id);
   }
 }
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits