Will deleting a CWnd through it's own PostNcDestroy message cause a memory leak if it was allocated on the heap?
Posted on 2006-10-31
I have a splash screen window that is allocated on the heap and deleted in it's PostNcDestroy message handler. Will this cause a memory leak?
The reason I'm asking is because a memory leak detection program pointed to the spot where I create a new Window on the heap with out deleting it before the function ended. It may be wrong in this case.
Details below, if needed:
It is created like this:
pSplash->Create(this,_T("My Splash"),1700,CSS_FADE | CSS_CENTERSCREEN | CSS_SHADOW);
And deleted like this:
This is preferable because the splash screen is killed as soon as a timer runs out:
void CSplashScreen::OnTimer(UINT nIDEvent)