Behavior of C++ after destruction
<p>I have an object that reads from a socket continuously like below:</p>

<pre><code>void CSocketReader::ReadComplete ( )
{
 messageProcessor-&gt;ResponseReceived ( response );
 read ();
}

void CSocketReader::read()
{
 socket.read(response);
}
</code></pre>

<p>My problem is, depending on the response and on the protocol that I am executing the ResponseReceived method could lead to deletion of the CSocketReader object. When the ResponseReceived method returns the object the this pointer points to would have been deleted ( but for some reason not known to me the this pointer is not NULL even after its deleted!! ). Next the read method executes and the program crashes within read. How can I reliably detect that the method that's been executing on an object has been deleted.</p>

<p>Please help.</p>
