[tor-commits] [vidalia/alpha] Fix destructor problem in ControlConnection and TorControl

chiiph at torproject.org chiiph at torproject.org
Sat Mar 17 17:01:06 UTC 2012


commit e7fffd73a98c589b8ef3ea374b8834e8864091b2
Author: Tomás Touceda <chiiph at torproject.org>
Date:   Fri Mar 16 13:19:51 2012 -0300

    Fix destructor problem in ControlConnection and TorControl
---
 src/torcontrol/ControlConnection.cpp |    6 +++---
 src/torcontrol/TorControl.cpp        |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/torcontrol/ControlConnection.cpp b/src/torcontrol/ControlConnection.cpp
index af3d2d3..389a6e3 100644
--- a/src/torcontrol/ControlConnection.cpp
+++ b/src/torcontrol/ControlConnection.cpp
@@ -34,6 +34,7 @@ ControlConnection::ControlConnection(ControlMethod::Method method, TorEvents *ev
   _events = events;
   _status = Unset;
   _sock = 0;
+  _connectTimer = 0;
   _sendWaiter = new SendCommandEvent::SendWaiter();
   _method = method;
   _connected = false;
@@ -44,9 +45,8 @@ ControlConnection::~ControlConnection()
 {
   /* Clean up after the send waiter */
   delete _sendWaiter;
-  delete _sock;
-  delete _connectTimer;
-  _sock = 0;
+  if(_sock) delete _sock;
+  if(_connectTimer) delete _connectTimer;
 }
 
 /** Connect to the specified Tor control interface. */
diff --git a/src/torcontrol/TorControl.cpp b/src/torcontrol/TorControl.cpp
index 0ad9db6..6f08e26 100644
--- a/src/torcontrol/TorControl.cpp
+++ b/src/torcontrol/TorControl.cpp
@@ -107,7 +107,7 @@ TorControl::~TorControl()
   if (isVidaliaRunningTor()) {
     stop();
   }
-  _controlConn->disconnect();
+  disconnect();
   delete _controlConn;
 }
 





More information about the tor-commits mailing list