From c7850570c146d2495420a1d9dcc8d29de9ea3d5b Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 22 Dec 2015 16:13:49 +0800 Subject: [PATCH] fix #546, thread terminate normally dispose bug. 2.0.203 --- README.md | 2 ++ trunk/src/app/srs_app_thread.cpp | 8 +++++--- trunk/src/core/srs_core.hpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5b285fe79c..2ead684510 100755 --- a/README.md +++ b/README.md @@ -337,6 +337,7 @@ Remark: ## History +* v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202 * v2.0, 2015-12-15, default hls_on_error to continue. 2.0.201 * v2.0, 2015-11-16, for [#518][bug #518] fix fd leak bug when fork. 2.0.200 @@ -1209,6 +1210,7 @@ Winlin [bug #511]: https://github.com/ossrs/srs/issues/511 [bug #518]: https://github.com/ossrs/srs/issues/518 [bug #541]: https://github.com/ossrs/srs/issues/541 +[bug #546]: https://github.com/ossrs/srs/issues/546 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/app/srs_app_thread.cpp b/trunk/src/app/srs_app_thread.cpp index 506f2238a7..d9027b9c34 100755 --- a/trunk/src/app/srs_app_thread.cpp +++ b/trunk/src/app/srs_app_thread.cpp @@ -232,11 +232,13 @@ namespace internal { // readly terminated now. really_terminated = true; - handler->on_thread_stop(); - srs_info("thread %s cycle finished", _name); - // when thread terminated normally, also disposed. + // we must set to disposed before the on_thread_stop, which may free the thread. + // @see https://github.com/ossrs/srs/issues/546 disposed = true; + + handler->on_thread_stop(); + srs_info("thread %s cycle finished", _name); } void* SrsThread::thread_fun(void* arg) diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 575b33cb62..c747e58399 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 2 #define VERSION_MINOR 0 -#define VERSION_REVISION 202 +#define VERSION_REVISION 203 // server info. #define RTMP_SIG_SRS_KEY "SRS"