title: Lock mutex of object before destroy it will deallocate memory or some other unexpected
body: <p>Is it a good and <strong>safe</strong> practice to lock mutex of the c++ object before <code>delete</code> this object <strong>(without unlocking)</strong>? I do this to protect possible using of object at this milliseconds from other thread (very low probability).</p>
  
  <p>Will the memory unallocated after that? Is it a good practice?</p>
  
  <p>Example: </p>
  
  <pre><code>    ptr_to_delete-&gt;MUTEX.lock_writing(); // can not delete session if its already locked. (additational protection)
      ptr_to_delete-&gt;cleanup();
      delete ptr_to_delete;
  </code></pre>