![]() |
Memory Leaks? |
Post Reply
|
| Author | |
martypku
Newbie
Joined: 17 September 2006 Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Topic: Memory Leaks?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
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 September 2006 at 3:53am |
|
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)
Quote Reply
Posted: 18 September 2006 at 4:49am |
|
Thanks! It works!
How can I know I must release an object by myself?
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 September 2006 at 5:09am |
|
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)
Quote Reply
Posted: 18 September 2006 at 6:02am |
|
Did you mean:"Once I create a CXTPPopupBar and assign it to a popup control, I must release it"? |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 September 2006 at 9:05am |
|
yes.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
martypku
Newbie
Joined: 17 September 2006 Status: Offline Points: 11 |
Post Options
Thanks(0)
Quote Reply
Posted: 18 September 2006 at 9:26am |
|
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 |