|
-
February 9th, 2000, 03:01 AM
#1
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.??
-
February 9th, 2000, 03:28 AM
#2
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!
-
February 9th, 2000, 05:58 AM
#3
Re: Destructor never called - help !
Forget OnDestroy() - you should override PostNcDestroy() and insert
delete this;
Scott Tunstall
[email protected]
-
February 9th, 2000, 10:26 AM
#4
Re: Destructor never called - help !
Excellent !!!
This solved my memoryleak problem coz now my cleanup functions got called.. THANXXX!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|