cec: fix segfault on exit
[deb_libcec.git] / src / lib / CECProcessor.cpp
index f3b89c3e3fe7e2e1382767430e063ad5e3451c06..4a276ee760b7cc1b1b406e127a3a8e6fc37d401c 100644 (file)
@@ -35,7 +35,7 @@
 #include "AdapterCommunication.h"
 #include "LibCEC.h"
 #include "util/StdString.h"
-#include "util/timeutils.h"
+#include "platform/timeutils.h"
 
 using namespace CEC;
 using namespace std;
@@ -89,14 +89,16 @@ void *CCECProcessor::Process(void)
         bParseFrame = ParseMessage(msg);
     }
 
-    if (bParseFrame)
+    if (!m_bStop && bParseFrame)
       ParseCurrentFrame();
 
-    m_controller->CheckKeypressTimeout();
-    CCondition::Sleep(50);
+    if (!m_bStop)
+    {
+      m_controller->CheckKeypressTimeout();
+      CCondition::Sleep(50);
+    }
   }
 
-  m_controller->AddLog(CEC_LOG_DEBUG, "processor thread terminated");
   return NULL;
 }