Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - Memory leak in modeless CXTPPropertySheet?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Memory leak in modeless CXTPPropertySheet?

 Post Reply Post Reply
Author
Message
nick_w View Drop Down
Newbie
Newbie


Joined: 15 July 2010
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote nick_w Quote  Post ReplyReply Direct Link To This Post Topic: Memory leak in modeless CXTPPropertySheet?
    Posted: 03 August 2010 at 2:24pm

I was testing modeless property sheet in CPropertySheetDlg::OnButtonTree() of PropertySheetDlg sample project. After I close the main window, I noticed there was memory leak for not deleting a CSamplePropertySheet object. So I called DestroyWindow()at window close but the memory leak was still there.

Any advice? Thanks.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 August 2010 at 5:41am
Hi,

You need manually delete pointer to ps. You can add member in your class and delete it in destructor.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
nick_w View Drop Down
Newbie
Newbie


Joined: 15 July 2010
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote nick_w Quote  Post ReplyReply Direct Link To This Post Posted: 09 August 2010 at 12:04pm
I did.
 
I have this in destructor
 

CPropertySheetDlg::~CPropertySheetDlg()

{

if ( m_pModelLessSheet )

{

delete m_pModelLessSheet->pNavigator;

m_pModelLessSheet->DestroyWindow();

m_pModelLessSheet = NULL;

}

}

if I add   delete m_pModelLessSheet;     
after destroy window, it will crash.
 
Originally posted by oleg oleg wrote:

Hi,

You need manually delete pointer to ps. You can add member in your class and delete it in destructor.
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 14 December 2010 at 4:05am
Could it be that you need to do this, using the good old way by calling delete this in WM_NCDESTROY ?
 
-cpede
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.