From 7fbb819bf6f590bf2337d2277f77487ef7a5ce86 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 6 Apr 2012 11:07:28 -0700 Subject: Making the threads (as well as the taskman thread) a bit more exception-robust. --- src/TaskMan.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/TaskMan.cc') diff --git a/src/TaskMan.cc b/src/TaskMan.cc index 0f205cf..d91581e 100644 --- a/src/TaskMan.cc +++ b/src/TaskMan.cc @@ -356,9 +356,10 @@ void Balau::TaskMan::stop(int code) { } void * Balau::TaskMan::TaskManThread::proc() { - m_taskMan = new Balau::TaskMan(); bool success = false; + m_taskMan = NULL; try { + m_taskMan = new Balau::TaskMan(); m_taskMan->mainLoop(); success = true; } @@ -390,7 +391,8 @@ void * Balau::TaskMan::TaskManThread::proc() { Printer::log(M_ERROR | M_ALERT, "The TaskMan thread caused an unknown exception"); } if (!success) { - delete m_taskMan; + if (m_taskMan) + delete m_taskMan; m_taskMan = NULL; TaskMan::stop(-1); } -- cgit v1.2.3