Memory Leaks? |
Post Reply |
Author | |
martypku
Newbie Joined: 17 September 2006 Status: Offline Points: 11 |
Post Options
Thanks(0)
Posted: 17 September 2006 at 10:02pm |
Version:8.7 VC6.0, SP6I add the following code to CMainFrame::OnCreate to dynamically add a menu at run-time:
CXTPPopupBar *pBar = (CXTPPopupBar*) CXTPPopupBar::CreatePopupBar(GetCommandBars());
CXTPControlPopup * pControlPopup = CXTPControlPopup::CreateControlPopup(xtpControlPopup); pControlPopup->SetCommandBar(pBar); pControlPopup->SetCaption("Test"); pControlPopup->SetEnabled(TRUE); CXTPControl * pControl = GetCommandBars()->GetMenuBar()->GetControls()->Add(pControlPopup, -1, "", -1, FALSE); VC reported memory leaks:
a CXTPControls object at $0003EDA0, 64 bytes long
a CXTPPopupBar object at $03037260, 408 bytes long
What's wrong?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
After this code add
pBar ->InternalRelease();
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
martypku
Newbie Joined: 17 September 2006 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Thanks! It works!
How can I know I must release an object by myself?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
It's one of exceptional situation in toolkit. because same popup bar can be assigned for different popup controls:
CXTPPopupBar *pBar = (CXTPPopupBar*) CXTPPopupBar::CreatePopupBar(GetCommandBars());
pControlPopup1->SetCommandBar(pBar); pControlPopup2->SetCommandBar(pBar);
pBar ->InternalRelease();
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
martypku
Newbie Joined: 17 September 2006 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Did you mean:"Once I create a CXTPPopupBar and assign it to a popup control, I must release it"? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
yes.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
martypku
Newbie Joined: 17 September 2006 Status: Offline Points: 11 |
Post Options
Thanks(0)
|
Thanks!
|
|
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 |