title: How to deallocate memory when a Qt window closes?
body: <p>I am currently creating a program in Qt, OpenCv, Mac os X. I have a main window, and then a separate window that is opened. I pass the new window several matrix clones in the constructor: </p>
  
  <pre><code>ImageWindow *imageWin = new ImageWindow( 
     cvCloneMat(getData-&gt;getMasterRawMat(1)), 
     cvCloneMat(getData-&gt;getMasterRawMat(2)), 
     cvCloneMat(getData-&gt;getMasterRawMat(3)), 
     cvCloneMat(getData-&gt;getMasterRawMat(4)) );
  imageWin-&gt;show();
  </code></pre>
  
  <p>How do I deallocate ( where do I call cvReleaseMat ), when the new window is closed?</p>