![]() |
You declared a destructor as non-virtual |
Post Reply ![]() |
Author | |
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() Posted: 04 December 2006 at 9:18am |
Hello,
It seems that you have declared a destructor as non-virtual, all our classes derived from CXTPFrameWndBase do not have their destructor called, thus making some memory leaks to our objects.
Here is your code :
In your file "XTPFrameWnd.h" :
class CXTPFrameWndBase : public CXTPCommandBarsSiteBase<TBase> { public: //----------------------------------------------------------------------- // Summary: // Constructs a CXTPFrameWndBase object //----------------------------------------------------------------------- CXTPFrameWndBase() { } //----------------------------------------------------------------------- // Summary: // Destroys a CXTPFrameWndBase object, handles cleanup and deallocation //----------------------------------------------------------------------- ~CXTPFrameWndBase() // !!!! Not virtual ??? { } ...
Could you please check it and tell us if it is a bug ?
Thank you in advance,
Regards,
|
|
Sergio
|
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
P.S. : Same problem for the class CXTPCommandBarsSiteBase
|
|
Sergio
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
it is not bug. All CWnd derived classes have virtual destuctors. virtual keyword doesn't requried.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Ok, then do you know why our destructor of our CMDIChildWnd is never called ?
Here is our code :
#define CChildFrameBase CXTPFrameWndBase<CMDIChildWnd>
class CLASS_DECL_FCORE CFMDIChildWnd : public CChildFrameBase
{ DECLARE_DYNCREATE(CFMDIChildWnd) protected: CFMDIChildWnd(); // protected constructor used by dynamic creation virtual ~CFMDIChildWnd(); ... Perhaps it's due to missing DECLARE_DYNCREATE(...) ?
|
|
Sergio
|
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
We have temporarily placed our cleanup code inside method OnDestroy (WM_DESTROY), to avoid memory leaks. Please tell us if you have more information about this destructor.
Thanks !
Regards,
|
|
Sergio
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
It must be called from PostNcDestroy.. mey be override this method or something. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Sergio ![]() Senior Member ![]() ![]() Joined: 18 September 2006 Status: Offline Points: 216 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg,
I finally found where was the problem. It isn't Codejock, it's our code :
virtual void PostNcDestroy() {}; // in child.h
This is the method who calls "delete this;"...
Sorry for the disturb and thank you very much for your help,
Best regards,
|
|
Sergio
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |