![]() |
Crash in CXTPPaintManager::DrawControl() |
Post Reply ![]() |
Author | |
jasonaross ![]() Newbie ![]() ![]() Joined: 24 August 2009 Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() Posted: 24 August 2009 at 2:45pm |
My application crashes when dereferencing a null pointer within DrawControl. Any ideas on whether this is a codejock issue or something i can prevent? My application has framework that can load different dlls/components dependent on the user action. As different components are loaded, we remove controls in the CXTPMenu bar and add some back. CXTPPaintManager::DrawControl(CDC* pDC, CXTPControl* pButton, BOOL bDraw) … return (pButton->GetParent()->GetType() == xtpBarTypePopup)? //crashes when getting the type for the parent of the button DrawControlPopupParent(pDC, pButton, bDraw): DrawControlToolBarParent(pDC, pButton, bDraw); Rewritten.. CXTPCommandBar* pjCXTPCommandBar = pButton->GetParent(); XTPBarType aXTPBarType = pjCXTPCommandBar->GetType(); //crashes here as pjCXTPCommandBar is NULL return (aXTPBarType == xtpBarTypePopup)? DrawControlPopupParent(pDC, pButton, bDraw): DrawControlToolBarParent(pDC, pButton, bDraw); CXTPControl::Draw( CXTPCommandBar::DrawCommandBar( CXTPCommandBar::OnPaint() CXTPCommandBar::OnWndMsg( CXTPCommandBar::DrawCommandBar( CXTPCommandBar::OnPaint() CXTPCommandBar::OnWndMsg( CWnd::UpdateWindow() CXTPPopupBar::SetTrackingMode(int 0, int 1, int 0) CXTPCommandBar::OnDestroy() CXTPCommandBar::OnWndMsg( CXTPHookManager::HookWndProc( CXTPCommandBar::OnFinalRelease() CXTPControlPopup::~CXTPControlPopup() CXTPControlPopup::`vector deleting destructor'( CXTPControls::RemoveAll() CEnhancedMenuController::AddComponentMenu //from my app It seems the CXTPControl objects' parent is set to null within CXTPControls::RemoveAll(). void CXTPControls::RemoveAll(void) { for (int nIndex = 0; nIndex < GetCount(); nIndex++) { CXTPControl* pControl = m_arrControls.GetAt(nIndex); pControl->m_pControls = NULL; //pControl->m_pParent = NULL; commenting out this line prevents the crash pControl->InternalRelease(); } m_arrControls.RemoveAll(); } ------------------ void CEnhancedMenuController::AddComponentMenu(long hMenu) CXTPControls* curControls = pMenuBar->GetControls(); ----------- Thanks in advance! |
|
Product: Xtreme Toolkit Pro v9.70
Platform: Windows XP (32bit) - SP 2 Language: Visual C++ 6.0 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi I guess problem somewhere else in your code. Maybe you store some pointer to some control and call it after you removed it and it not valid anymore.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
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 |