diff --git a/Controller.cpp b/Controller.cpp index 35b0213..2c2ca29 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -35,9 +35,23 @@ bool CController::Start() void CController::Stop() { keep_running = false; - reflectorThread.get(); - ambeThread.get(); + if (reflectorThread.valid()) + reflectorThread.get(); + if (ambeThread.valid()) + ambeThread.get(); reader.Close(); + for (auto &it : dstar_device) + { + it->CloseDevice(); + it.reset(); + } + dstar_device.clear(); + for (auto &it : dmr_device) + { + it->CloseDevice(); + it.reset(); + } + dmr_device.clear(); } bool CController::InitDevices() diff --git a/Main.cpp b/Main.cpp index 120b1e1..3814d59 100644 --- a/Main.cpp +++ b/Main.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include #include #include "Controller.h" @@ -24,6 +25,8 @@ int main() if (controller.Start()) return EXIT_FAILURE; + pause(); + controller.Stop(); return EXIT_SUCCESS;