Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - CodeJock crashes in docking pane solved???
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CodeJock crashes in docking pane solved???

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 804
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CodeJock crashes in docking pane solved???
    Posted: 20 June 2022 at 11:01am
We have a number of crashes in the customer base for a few years now. Almost always have the same call CJ stack or one closely related to it related to drawing a pane or getting a tooltip from a pane. Here is the most common one:

     ToolkitPro1930vc160x64U.dll!CXTPDockingPane::GetOptions() Line 502    C++
     ToolkitPro1930vc160x64U.dll!CXTPDockingPaneTabbedContainer::IsTitleVisible() Line 577    C++
     ToolkitPro1930vc160x64U.dll!CXTPDockingPanePaintManager::AdjustCaptionRect(const CXTPDockingPaneTabbedContainer *, CRect &) Line 772    C++
     ToolkitPro1930vc160x64U.dll!CXTPDockingPaneOffice2013Theme::DrawPane(CDC *, CXTPDockingPaneTabbedContainer *, CRect) Line 230    C++
     ToolkitPro1930vc160x64U.dll!CXTPDockingPaneTabbedContainer::OnPaint() Line 561    C++

Today I got lucky and attached a debugger while I had release PDB files available and the call stack is the one above. Here is what I found. Notice CJ handles a nullptr m_pLayout:

CXTPDockingPaneManager* CXTPDockingPaneBase::GetDockingPaneManager() const
{
    ASSERT(m_pLayout);
    if (!m_pLayout)
        return NULL;

    ASSERT(m_pLayout->m_pManager);
    return m_pLayout->m_pManager;
}

However, check out the code that crashed us:

DWORD CXTPDockingPane::GetOptions() const
{
    return GetDockingPaneManager()->m_dwDefaultPaneOptions | m_dwOptions;
}

XTPDockingPane.cpp has a lot of calls to GetDockingPaneManager()->SomeMethod(...). So, if the layout is nullptr, CJ handles that and returns nullptr but the code doesn't check the pointer.

Time to edit CJ code again and I hope CJ will address this sort of calls where code calls to get a pointer and does the "GetPointer()->" code pattern when other CJ code apparently knows the pointer being obtained can be null.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 804
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 27 June 2022 at 9:03am
Another crash log from a customer led me to find another one of these non-pointer tests. This one is in CXTPDockingPaneTabbedContainer::OnToolHitTest(CPoint point, TOOLINFO* pTI)

            CString strTip = GetSelected()->GetTitleToolTip();

Though in this case, I'm pretty sure it is the same issue I am now trying to fix - the selected pane has been deleted but the m_pSelectedPane pointer still points to the pane. TRACE statements and debugging has shown me the selected pane can get closed and the member still points to it when some paint or mouse message is dispatched to the container.
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.