Dear Sir:<br><br>In <br><pre class="fragment"><span class="code">00145</span> <span class="code">RTSPClient::~RTSPClient</span>() {<br><a name="l00146"></a>00146   <span class="code">reset</span>();<br><a name="l00147"></a>
00147   <span class="code">envir</span>().<span class="code">taskScheduler</span>().<span class="code">turnOffBackgroundReadHandling</span>(<span class="code">fInputSocketNum</span>);<br><a name="l00148"></a>00148   <span class="keyword">
delete</span>[] <span class="code">fResponseBuffer</span>;<br><a name="l00149"></a>00149   <span class="keyword">delete</span>[] <span class="code">fUserAgentHeaderStr</span>;<br><a name="l00150"></a>00150 },</pre>I note reset() calls closeTCPSockets() to set fIinputSocketNum = fOutputSocketNum = -1 which causes the following
<span class="code"></span><span class="code"></span> <span class="code">turnOffBackgroundReadHandling</span>(<span class="code">fInputSocketNum</span>) not to clear <span class="code">fInputSocketNum</span>
&nbsp;in the fReadset of <span class="code">envir</span>().<span class="code">taskScheduler</span>(). As a result, after ~RTCPClient(), the select() in SingleStep() returns -1 with errno == EBADF and leads the program to exit!
<br><br>It seems that changing their order can avoid this problem and people can happily control the life cycle of the instances of RTSPClient in another select callback in SingleStep(). Hope this helpful for you. I may not consider everything clearly, just be careful.
<br><br>BR.<br>Brain Lai<br>