CustomControl & CXTPControlLabel |
Post Reply |
Author | |
jimmy
Senior Member Joined: 11 November 2003 Location: Austria Status: Offline Points: 515 |
Post Options
Thanks(0)
Posted: 18 May 2010 at 7:23am |
Hello,
i've a Control based on CXTPControlCustom On Painting of my control, i use the CXTPControlLabel class to draw a label into my control class CXTPControlLabelHelper : public CXTPControlLabel { public: virtual void SetParent(CXTPCommandBar* pParent) { __super::SetParent(pParent); } void SetType(XTPControlType type) { m_controlType = type; m_bSelected = TRUE; } virtual int GetSelected() const { return m_bSelected; } }; void MyControl::OnPaint() { .... CXTPControlLabelHelper label; label.SetCaption(strText); label.SetParent(m_pControl->GetParent()); if (m_pControl->IsFocused()) label.SetType(xtpControlCustom); else { // Codejock bei ThemeRibbon hotfix if (!m_pControl->GetPaintManager()->m_bOffsetPopupLabelText) rcText.left += nGripperWidth; } label.SetRect(rcText); m_pControl->GetPaintManager()->DrawControlPopupParent(&dc, &label, TRUE); } m_pControl is a pointer to my CXTPControlCustom object. In Debug it work correct. But in release it crash in CXTPControlLabel destructor. Here is the callstack mfc71.dll!CCmdTarget::ExternalQueryInterface(const void * iid=0x774b1a80, void * * ppvObj=0x0012ebb0) Zeile 332 C++ ToolkitPro1400vc71.dll!CXTPAccessible::XAccessible::QueryInterface() + 0x1e C++ ole32.dll!_CoDisconnectObject@8() + 0x4a mfc71.dll!CCmdTarget::ExternalDisconnect() Zeile 396 C++ mfc71.dll!CCmdTarget::~CCmdTarget() Zeile 51 C++ ToolkitPro1400vc71.dll!CXTPControl::~CXTPControl() + 0x104 C++ Lasal2.exe!CMarkupFilterCtrl::OnPaint() Zeile 270 + 0x12 C++ i use VS.NET 2003 & CJ V14.0.0beta Jimmy |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
I guess your control receives WM_PAINT, and is then deleted from elsewhere - destroying your markup context. In debug-mode the memory stays intact, but in release mode it is probably zeroed out or altered by some other memory allocation.
Make sure your custom control HWND is destroyed before the destructor is called:
CMainFrame::OnDestroy()
{
m_customWindowCtrl.DestroyWindow();
}
|
|
PokerMemento - http://www.pokermemento.com/
|
|
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 |