diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-13 02:27:13 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-01-13 02:27:13 (GMT) |
commit | a637f8d8011160c456715a7efddc457febab0bae (patch) | |
tree | ac3426d577376a762f6872dd76e78ceff36ade86 | |
parent | c443aaa23e079d8ab94942bfefa65b940c1acd01 (diff) | |
download | uscxml-a637f8d8011160c456715a7efddc457febab0bae.zip uscxml-a637f8d8011160c456715a7efddc457febab0bae.tar.gz uscxml-a637f8d8011160c456715a7efddc457febab0bae.tar.bz2 |
Proper initialization enables proper destruction
-rw-r--r-- | src/uscxml/Interpreter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 45ef4b2..b46d60d 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -29,6 +29,11 @@ const std::string Interpreter::getUUID() { } Interpreter::Interpreter() : Arabica::SAX2DOM::Parser<std::string>() { + _lastRunOnMainThread = 0; + _thread = NULL; + _sendQueue = NULL; + _running = false; + #ifdef _WIN32 WSADATA wsaData; WSAStartup(MAKEWORD(2, 2), &wsaData); @@ -130,9 +135,6 @@ Interpreter* Interpreter::fromInputSource(Arabica::SAX::InputSource<std::string> } void Interpreter::init() { - _lastRunOnMainThread = 0; - _thread = NULL; - _running = false; _sendQueue = new DelayedEventQueue(); _sendQueue->start(); if (_document) { @@ -165,7 +167,8 @@ Interpreter::~Interpreter() { _thread->join(); delete(_thread); } - delete _sendQueue; + if (_sendQueue) + delete _sendQueue; } void Interpreter::start() { |