winlin

fix #546, thread terminate normally dispose bug. 2.0.203

@@ -337,6 +337,7 @@ Remark: @@ -337,6 +337,7 @@ Remark:
337 337
338 ## History 338 ## History
339 339
  340 +* v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203
340 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202 341 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202
341 * v2.0, 2015-12-15, default hls_on_error to continue. 2.0.201 342 * v2.0, 2015-12-15, default hls_on_error to continue. 2.0.201
342 * v2.0, 2015-11-16, for [#518][bug #518] fix fd leak bug when fork. 2.0.200 343 * v2.0, 2015-11-16, for [#518][bug #518] fix fd leak bug when fork. 2.0.200
@@ -1209,6 +1210,7 @@ Winlin @@ -1209,6 +1210,7 @@ Winlin
1209 [bug #511]: https://github.com/ossrs/srs/issues/511 1210 [bug #511]: https://github.com/ossrs/srs/issues/511
1210 [bug #518]: https://github.com/ossrs/srs/issues/518 1211 [bug #518]: https://github.com/ossrs/srs/issues/518
1211 [bug #541]: https://github.com/ossrs/srs/issues/541 1212 [bug #541]: https://github.com/ossrs/srs/issues/541
  1213 +[bug #546]: https://github.com/ossrs/srs/issues/546
1212 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1214 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1213 1215
1214 [exo #828]: https://github.com/google/ExoPlayer/pull/828 1216 [exo #828]: https://github.com/google/ExoPlayer/pull/828
@@ -232,11 +232,13 @@ namespace internal { @@ -232,11 +232,13 @@ namespace internal {
232 // readly terminated now. 232 // readly terminated now.
233 really_terminated = true; 233 really_terminated = true;
234 234
235 - handler->on_thread_stop();  
236 - srs_info("thread %s cycle finished", _name);  
237 -  
238 // when thread terminated normally, also disposed. 235 // when thread terminated normally, also disposed.
  236 + // we must set to disposed before the on_thread_stop, which may free the thread.
  237 + // @see https://github.com/ossrs/srs/issues/546
239 disposed = true; 238 disposed = true;
  239 +
  240 + handler->on_thread_stop();
  241 + srs_info("thread %s cycle finished", _name);
240 } 242 }
241 243
242 void* SrsThread::thread_fun(void* arg) 244 void* SrsThread::thread_fun(void* arg)
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 202 34 +#define VERSION_REVISION 203
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"