delete a pointer getting AccessViolationException
<p>I have a class pointer declaration:</p>

<pre><code>MyClass* a;
</code></pre>

<p>In destruction method I have:</p>

<pre><code>    if (a)
    {
        delete a;
        a= NULL;
    }
</code></pre>

<p>I got a problem when delete the pointer a:</p>

<pre><code>Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
</code></pre>

<p>What is the cause of the problem and how can I get rid of it?</p>

<p>Thanks in advance. </p>
