[tor-commits] [vidalia/alpha] Improve the engine functionality

chiiph at torproject.org chiiph at torproject.org
Wed Sep 7 13:53:11 UTC 2011


commit 871fc5a7cc4817e3b02fa08568d69b6325997a6f
Author: Tomas Touceda <chiiph at torproject.org>
Date:   Tue Jul 26 00:24:52 2011 -0300

    Improve the engine functionality
    
    Actually delete the engine, so the stop methods are called.
    Output the plugin exceptions to vInfo messages too, so problems in the stop
    method are actually printed somewhere.
    Add the state() method for the rest of the implementation of TBB.
---
 src/vidalia/MainWindow.cpp                         |    5 ++++-
 src/vidalia/plugin/PluginWrapper.cpp               |    5 ++++-
 .../plugin/prototypes/HelperProcessPrototype.cpp   |   11 +++++++++++
 .../plugin/prototypes/HelperProcessPrototype.h     |    1 +
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index 96d6482..46cd0db 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -118,7 +118,10 @@ MainWindow::MainWindow()
 }
 
 /** Destructor */
-MainWindow::~MainWindow() {}
+MainWindow::~MainWindow()
+{
+  delete _engine;
+}
 
 /** Calls the different methods that will handle the GUI "creation".
  * It's called once at the MainWindow creation. */
diff --git a/src/vidalia/plugin/PluginWrapper.cpp b/src/vidalia/plugin/PluginWrapper.cpp
index 87a6ff1..c74ef7b 100644
--- a/src/vidalia/plugin/PluginWrapper.cpp
+++ b/src/vidalia/plugin/PluginWrapper.cpp
@@ -16,6 +16,7 @@
 #include "PluginWrapper.h"
 #include "PluginEngine.h"
 #include "DebugDialog.h"
+#include "Vidalia.h"
 
 #include <QtXml>
 
@@ -156,8 +157,10 @@ PluginWrapper::checkExceptions()
                             .arg(_engine->uncaughtExceptionLineNumber())
                             .arg(name()));
     DebugDialog::exceptDebug(tr("*** Backtrace:"));
-    foreach(QString line, _engine->uncaughtExceptionBacktrace())
+    foreach(QString line, _engine->uncaughtExceptionBacktrace()) {
+      vInfo(line);
       DebugDialog::exceptDebug(line);
+    }
 
     _engine->clearExceptions();
 
diff --git a/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp b/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp
index 2fcd126..6b91660 100644
--- a/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp
+++ b/src/vidalia/plugin/prototypes/HelperProcessPrototype.cpp
@@ -78,3 +78,14 @@ HelperProcessPrototype::setEnvironment(const QStringList &env)
   if(obj)
     obj->setEnvironment(env);
 }
+
+HelperProcess::ProcessState
+HelperProcessPrototype::state()
+{
+  HelperProcess *obj = qscriptvalue_cast<HelperProcess *>(thisObject());
+
+  if(obj)
+    return obj->state();
+
+  return HelperProcess::NotRunning;
+}
diff --git a/src/vidalia/plugin/prototypes/HelperProcessPrototype.h b/src/vidalia/plugin/prototypes/HelperProcessPrototype.h
index 1751347..1dae103 100644
--- a/src/vidalia/plugin/prototypes/HelperProcessPrototype.h
+++ b/src/vidalia/plugin/prototypes/HelperProcessPrototype.h
@@ -21,6 +21,7 @@ class HelperProcessPrototype : public QObject, public QScriptable
     Q_INVOKABLE bool isDone() const;
     Q_INVOKABLE QStringList systemEnvironment();
     Q_INVOKABLE void setEnvironment(const QStringList &env);
+    Q_INVOKABLE QProcess::ProcessState state();
 };
 
 Q_DECLARE_METATYPE(HelperProcess *);





More information about the tor-commits mailing list