Destructor never called - help !
My CMainFrm class derived from CFrameWnd is created in the InitInstance() func. with 'new'. When i later on in the app by a keydown calls PostQuitMessage(0) the app exits but the CMainFrm class destructor never is called.. Why ?. Should all setupcode and cleanup ( except wnd creation ) be made in other funcs.??
Re: Destructor never called - help !
Hi!
This is the main trouble with dynamic allocation. Since you created the object with new, you are responsible for deallocating (delete) it yourself, for example in OnDestroy(), or some destructor.
Hope this helps!
Re: Destructor never called - help !
Forget OnDestroy() - you should override PostNcDestroy() and insert
delete this;
Scott Tunstall
[email protected]
Re: Destructor never called - help !
Excellent !!!
This solved my memoryleak problem coz now my cleanup functions got called.. THANXXX!!!