Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Custom Grid Control:  Memory Leak
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Custom Grid Control: Memory Leak

 Post Reply Post Reply
Author
Message
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Topic: Custom Grid Control: Memory Leak
    Posted: 24 October 2006 at 4:44pm
I've created a custom grid control that is leaking CXTPPopupBars.  Is there a reason why this code would be leaking the pColorBar instead of automatically being freed by the Codejock framework?

void CRgbaColorMenuGridItem::OnInplaceButtonDown()
{
    CRect rcItem= GetItemRect();
    m_pGrid->ClientToScreen(&rcItem);
    rcItem.left = rcItem.right - 158; // small hack. need to add CPS_XT_LEFTALLIGN
   
    // Bar to contain the controls
    CXTPPopupBar* pColorBar = (CXTPPopupBar*)CXTPPopupBar::CreateObject();
    pColorBar->SetFlags(xtpThemeOfficeXP);

    CXTPCommandBars::TrackPopupMenu(pColorBar, 0, rcItem.left, rcItem.bottom, m_pMsgWnd, NULL, m_pMsgWnd);
}

Back to Top
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Posted: 24 October 2006 at 4:47pm
Poor man's UML class diagram.  Inheritance:


CXTPPropertyGridItem
        ^
        |
CRgbaPropertyGridItemColor
        ^
        |
CRgbaColorMenuGridItem



Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 25 October 2006 at 1:12am
Hi,
 
After TrackPopupMenu add
pColorBar->InternalrRelease();
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Posted: 25 October 2006 at 11:08am
Thanks Oleg.  Memory leak vanquished.  :)
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.047 seconds.