diff --git a/README.md b/README.md index 52f695c6a..c257bf39b 100755 --- a/README.md +++ b/README.md @@ -1288,6 +1288,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_st.cpp b/trunk/src/app/srs_app_st.cpp index 18f45d80b..6d57a9e20 100644 --- a/trunk/src/app/srs_app_st.cpp +++ b/trunk/src/app/srs_app_st.cpp @@ -237,11 +237,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)