From 2a6f19763c3deda04bdb83f1cf0406549dc0039d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 27 Oct 2021 21:28:50 +0200 Subject: [PATCH] scanait: another ait segfault fix Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/48a03894d1ba20c0a0ede1cb2429d2006a82fe56 Author: Jacek Jendrzej Date: 2021-10-27 (Wed, 27 Oct 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/zapit/include/zapit/scanait.h | 1 + src/zapit/src/scanait.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/zapit/include/zapit/scanait.h b/src/zapit/include/zapit/scanait.h index cb28e94e9..fafcdec3a 100644 --- a/src/zapit/include/zapit/scanait.h +++ b/src/zapit/include/zapit/scanait.h @@ -44,6 +44,7 @@ class CAit : public OpenThreads::Thread private: int dmxnum; unsigned short pid; + bool running; std::string name; ApplicationInformationSectionList sections; void run(); diff --git a/src/zapit/src/scanait.cpp b/src/zapit/src/scanait.cpp index 375250f43..a212e9002 100644 --- a/src/zapit/src/scanait.cpp +++ b/src/zapit/src/scanait.cpp @@ -41,6 +41,7 @@ CAit::CAit() { dmxnum = 0; pid = 0; + running = false; } void CAit::setDemux(int dnum) @@ -50,17 +51,22 @@ void CAit::setDemux(int dnum) bool CAit::Start() { + if (running) + return false; + running = true; + int ret = start(); return (ret == 0); } bool CAit::Stop() { - if(pid > 0){ - int ret = join(); - return (ret == 0); - } - return false; + if (!running) + return false; + running = false; + + int ret = join(); + return (ret == 0); } void CAit::run()