summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-13 02:27:13 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-01-13 02:27:13 (GMT)
commita637f8d8011160c456715a7efddc457febab0bae (patch)
treeac3426d577376a762f6872dd76e78ceff36ade86
parentc443aaa23e079d8ab94942bfefa65b940c1acd01 (diff)
downloaduscxml-a637f8d8011160c456715a7efddc457febab0bae.zip
uscxml-a637f8d8011160c456715a7efddc457febab0bae.tar.gz
uscxml-a637f8d8011160c456715a7efddc457febab0bae.tar.bz2
Proper initialization enables proper destruction
-rw-r--r--src/uscxml/Interpreter.cpp11
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() {