|  | 
| CXTPCommandBarsSiteBase memory leak | 
| Post Reply   | 
| Author | |
| znakeeye   Senior Member     Joined: 26 July 2006 Status: Offline Points: 1672 |  Post Options  Thanks(0)  Quote  Reply  Topic: CXTPCommandBarsSiteBase memory leak Posted: 16 October 2009 at 5:04am | 
| XTP 12.0.1, but I think this is present in all versions. class CMyPane : public CXTPFrameWndBase<CWnd> ... int CMyPane::OnCreate(LPCREATESTRUCT lpCreateStruct) {     if (CXTPFrameWndBase<CWnd>::OnCreate(lpCreateStruct) == -1)          return -1;     InitCommandBars();     ... } In my application this window is created, destroyed and then created again - without destroying the CMyPane-object: m_myPane.Destroy(); ... m_myPane.Create(...); // MEMORY LEAK! The error lies in XTPFrameWnd.h. Obviously, you don't think about the above scenario! virtual BOOL InitCommandBars(CRuntimeClass* pCommandBarsClass = RUNTIME_CLASS(CXTPCommandBars)) {     // Begin FIX     if (m_pCommandBars) { m_pCommandBars->InternalRelease(); }     // End FIX ASSERT(pCommandBarsClass->IsDerivedFrom(RUNTIME_CLASS(CXTPCommandBars))); m_pCommandBars = (CXTPCommandBars*) pCommandBarsClass->CreateObject(); ASSERT(m_pCommandBars); if (!m_pCommandBars) return FALSE; m_pCommandBars->SetSite(this); m_pCommandBars->EnableDocking(); return TRUE; } | |
| 
     PokerMemento - http://www.pokermemento.com/
     | |
|  | |
| znakeeye   Senior Member     Joined: 26 July 2006 Status: Offline Points: 1672 |  Post Options  Thanks(0)  Quote  Reply  Posted: 16 October 2009 at 5:07am | 
| 
   Hmmm, why not destroy the command-bar in OnDestroy()?
    | |
| 
     PokerMemento - http://www.pokermemento.com/
     | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  Posted: 16 October 2009 at 5:23am | 
| 
   Hi,
 Thanks, indeed we didn't catch such scenario. I will add same fix code. Thanks. | |
| 
     Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS | |
|  | |
| terrym   Senior Member   Joined: 13 April 2007 Status: Offline Points: 836 |  Post Options  Thanks(0)  Quote  Reply  Posted: 16 October 2009 at 7:50am | 
| 
   Did this make fix for 13.2?
    | |
| 
     Thank you, Terry Mancey email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey | |
|  | |
| Oleg   Senior Member   Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |  Post Options  Thanks(0)  Quote  Reply  Posted: 18 October 2009 at 1:27am | 
| 
   yes, sure.
    | |
| 
     Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS | |
|  | |
| terrym   Senior Member   Joined: 13 April 2007 Status: Offline Points: 836 |  Post Options  Thanks(0)  Quote  Reply  Posted: 18 October 2009 at 4:42am | 
| 
   Excellent
    | |
| 
     Thank you, Terry Mancey email terry@tmancey.ltd.uk | linkedin www.tmancey.ltd.uk | twitter @tmancey | |
|  | |
| 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 |