]> git.siccegge.de Git - frida/frida.git/commitdiff
properly terminate guile thread v0.2
authorChristoph Egger <christoph@christoph-egger.org>
Tue, 26 May 2015 19:23:49 +0000 (21:23 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Tue, 26 May 2015 19:23:49 +0000 (21:23 +0200)
src/bindings/Guile.cxx
src/bindings/Guile.hxx

index 18d12e95eef91b5edec0624b5797a68081678546..aa7ea526118c205f5278e632fef4d554d9e6b887 100644 (file)
@@ -15,7 +15,7 @@ GuileInterpreter::GuileInterpreter()
        scm_init_guile();
        scm_c_use_module("system repl server");
 
-       guile::Geiser* geiser = new guile::Geiser(this);
+       geiser = new guile::Geiser(this);
        geiser->start();
 
        scm_c_load_extension("libguile-frida-binding",
@@ -28,6 +28,11 @@ GuileInterpreter::GuileInterpreter()
        LOG4CXX_INFO(logger, "Initializing GUILE finished");
 }
 
+GuileInterpreter::~GuileInterpreter() {
+       geiser->terminate();
+       geiser->wait();
+}
+
 int GuileInterpreter::evaluateWithErrorHandling(SCM (*fun)(void *),
                                                 void* data,
                                                 std::ostream& stdout,
index 244bb1cc07ab620119e2f941f658453b26f6ff07..63d5fcbafdad62bacbec6f8fbaa9c61fde1ba168 100644 (file)
@@ -7,12 +7,24 @@
 #include "qt.hxx"
 #include "Interpreter.hxx"
 
+namespace guile {
+       class Geiser : public QThread {
+               Q_OBJECT
+       public:
+               Geiser(QObject* parent) : QThread(parent) {}
+               Geiser() {}
+       private:
+               void run() Q_DECL_OVERRIDE;
+       };
+}
+
 class GuileInterpreter : public QObject, public Interpreter {
     Q_OBJECT
     Q_PLUGIN_METADATA(IID "xyz.frida.Interpreter")
     Q_INTERFACES(Interpreter)
 public:
        GuileInterpreter();
+       virtual ~GuileInterpreter();
 
        int evaluate(const std::string& command,
                     std::ostream& stdout,
@@ -35,17 +47,7 @@ private:
        SCM guile_output_port;
        SCM guile_error_port;
        log4cxx::LoggerPtr logger;
+       guile::Geiser* geiser;
 };
 
-namespace guile {
-       class Geiser : public QThread {
-               Q_OBJECT
-       public:
-               Geiser(QObject* parent) : QThread(parent) {}
-       private:
-               void run() Q_DECL_OVERRIDE;
-       };
-}
-
-
 #endif /* INCLUDE__Guile_hxx_ */