From f643fc512a9ad9a68060d64bff753d2f4b8d2d41 Mon Sep 17 00:00:00 2001 From: LX3JL Date: Sat, 16 Mar 2019 18:53:31 +0100 Subject: [PATCH] ambed 1.3.3 Corrected bug crashing ambed --- ambed/cstream.cpp | 32 ++++++++++++++++++-------------- ambed/main.h | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) mode change 100644 => 100755 ambed/cstream.cpp mode change 100644 => 100755 ambed/main.h diff --git a/ambed/cstream.cpp b/ambed/cstream.cpp old mode 100644 new mode 100755 index feb3cac..6a4a94b --- a/ambed/cstream.cpp +++ b/ambed/cstream.cpp @@ -71,18 +71,20 @@ CStream::CStream(uint16 uiId, const CCallsign &Callsign, const CIp &Ip, uint8 ui CStream::~CStream() { - m_Socket.Close(); - if ( m_VocodecChannel != NULL ) - { - g_Vocodecs.CloseChannel(m_VocodecChannel); - m_VocodecChannel = NULL; - } - + // stop thread first m_bStopThread = true; if ( m_pThread != NULL ) { m_pThread->join(); delete m_pThread; + m_pThread = NULL; + } + + // then close everything + m_Socket.Close(); + if ( m_VocodecChannel != NULL ) + { + m_VocodecChannel->Close(); } } @@ -134,13 +136,7 @@ bool CStream::Init(uint16 uiPort) void CStream::Close(void) { - // close everything - m_Socket.Close(); - if ( m_VocodecChannel != NULL ) - { - m_VocodecChannel->Close(); - } - + // stop thread first m_bStopThread = true; if ( m_pThread != NULL ) { @@ -148,6 +144,14 @@ void CStream::Close(void) delete m_pThread; m_pThread = NULL; } + + // then close everything + m_Socket.Close(); + if ( m_VocodecChannel != NULL ) + { + m_VocodecChannel->Close(); + } + // report std::cout << m_iLostPackets << " of " << m_iTotalPackets << " packets lost" << std::endl; diff --git a/ambed/main.h b/ambed/main.h old mode 100644 new mode 100755 index a432f36..4d0baad --- a/ambed/main.h +++ b/ambed/main.h @@ -49,7 +49,7 @@ #define VERSION_MAJOR 1 #define VERSION_MINOR 3 -#define VERSION_REVISION 2 +#define VERSION_REVISION 3 // global ------------------------------------------------------