From 4691dc3b885e390988f6104336afc682f3b157a2 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Mon, 14 May 2012 10:47:10 +0200 Subject: [PATCH] cec: don't allow client registrations when the processor thread isn't running --- src/lib/CECProcessor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index 0714d2a..d9981b9 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -81,9 +81,7 @@ bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = CEC_SERIA // create the processor thread if (!IsRunning()) { - if (CreateThread()) - m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started"); - else + if (!CreateThread()) { m_libcec->AddLog(CEC_LOG_ERROR, "could not create a processor thread"); return false; @@ -645,7 +643,7 @@ CCECTuner *CCECProcessor::GetTuner(cec_logical_address address) const bool CCECProcessor::RegisterClient(CCECClient *client) { - if (!client) + if (!client || !IsRunning()) return false; // unregister the client first if it's already been marked as registered @@ -732,7 +730,8 @@ void CCECProcessor::UnregisterClient(CCECClient *client) if (!client) return; - m_libcec->AddLog(CEC_LOG_NOTICE, "unregistering client: %s", client->GetConnectionInfo().c_str()); + if (client->IsRegistered()) + m_libcec->AddLog(CEC_LOG_NOTICE, "unregistering client: %s", client->GetConnectionInfo().c_str()); // notify the client that it will be unregistered client->OnUnregister(); -- 2.34.1