Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Crash in control bars with some are in auto-hide state Collapse All
Subject Author Date
Offer Har May 11, 2010 - 4:46 AM

Dear Support,


I have 2 control-bars - one is in docked in auto-hide to one edge of the main-frame, and the second is hidden.


I now what to show the hidden control-bar, so I show it, and I want it to be displayed next to the cursor, so I call FloatControlBar. The minute I call this function my application crashes, at this location:


 


bool CExtBarNcAreaButton::IsBarAutoHideMode(     bool * p_bDisplayed, // = NULL     bool * p_bActive // = NULL     ) const {     ASSERT_VALID( this );     if( p_bDisplayed != NULL )         *p_bDisplayed = false;     if( p_bActive != NULL )         *p_bActive = false; bool bAutohide = m_pBar->AutoHideModeGet();     if( !bAutohide )         return false;     if( p_bDisplayed != NULL || p_bActive != NULL )     {         ASSERT_VALID( m_pBar->m_pDockBar );         ASSERT_KINDOF( CExtDockBar, m_pBar->m_pDockBar );

...




And I see that m_pBar->m_pDockBar is of type CDockBar and not CExtDockBar


What is the problem? How to fix this? Is this a bug?


Below is the call-stack.


Thanks!


Ron.


 


 


ntdll.dll!7c90120e()     [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]    msvcr80d.dll!_CrtDbgBreak()  Line 89    C msvcr80d.dll!_VCrtDbgReportA(int nRptType=2, const char * szFile=0x01f56550, int nLine=13466, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x00127b58)  Line 290    C msvcr80d.dll!_CrtDbgReportV(int nRptType=2, const char * szFile=0x01f56550, int nLine=13466, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x00127b58)  Line 300 + 0x1d bytes    C msvcr80d.dll!_CrtDbgReport(int nRptType=2, const char * szFile=0x01f56550, int nLine=13466, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Line 317 + 0x1d bytes    C mfc80d.dll!AfxAssertFailedLine(const char * lpszFileName=0x01f56550, int nLine=13466)  Line 25 + 0x14 bytes    C++ >    ProfUIS287md.dll!CExtBarNcAreaButton::IsBarAutoHideMode(bool * p_bDisplayed=0x00127bd3, bool * p_bActive=0x00000000)  Line 13466 + 0x2a bytes    C++ ProfUIS287md.dll!CExtBarNcAreaButton::OnQueryVisibility()  Line 13816 + 0xe bytes    C++ ProfUIS287md.dll!CExtBarNcAreaButtonClose::OnQueryVisibility()  Line 14553 + 0x8 bytes    C++ ProfUIS287md.dll!CExtControlBar::OnNcAreaButtonsReposition()  Line 13368 + 0xf bytes    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::OnTimer(unsigned int nIDEvent=1)  Line 1784 + 0x12 bytes    C++ mfc80d.dll!CWnd::OnWndMsg(unsigned int message=275, unsigned int wParam=1, long lParam=0, long * pResult=0x00127ecc)  Line 2032    C++ mfc80d.dll!CWnd::WindowProc(unsigned int message=275, unsigned int wParam=1, long lParam=0)  Line 1741 + 0x20 bytes    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::WindowProc(unsigned int message=275, unsigned int wParam=1, long lParam=0)  Line 2364 + 0x14 bytes    C++ mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x39d71560, HWND__ * hWnd=0x001521e0, unsigned int nMsg=275, unsigned int wParam=1, long lParam=0)  Line 240 + 0x1c bytes    C++ mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x001521e0, unsigned int nMsg=275, unsigned int wParam=1, long lParam=0)  Line 389    C++ mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x001521e0, unsigned int nMsg=275, unsigned int wParam=1, long lParam=0)  Line 411 + 0x15 bytes    C++ user32.dll!7e418734()     user32.dll!7e418816()     ntdll.dll!7c90e473()     user32.dll!7e4189cd()     user32.dll!7e4274b2()     user32.dll!7e418a10()     user32.dll!7e427721()     user32.dll!7e4249c4()     user32.dll!7e43a956()     msvcr80d.dll!_output_s_l(_iobuf * stream=0x000b18b6, const char * format=0x00194200, localeinfo_struct * plocinfo=0x00196ad0, char * argptr=0x00012012)  Line 1166 + 0x17 bytes    C++ user32.dll!7e4664a2()     user32.dll!7e450877()     user32.dll!7e45082f()     msvcr80d.dll!__crtMessageBoxA(const char * lpText=0x001287bc, const char * lpCaption=0x102d315c, unsigned int uType=73746)  Line 168 + 0x13 bytes    C msvcr80d.dll!__crtMessageWindowA(int nRptType=2, const char * szFile=0x01f56550, const char * szLine=0x0012a830, const char * szModule=0x00000000, const char * szUserMessage=0x00129830)  Line 420 + 0x16 bytes    C msvcr80d.dll!_VCrtDbgReportA(int nRptType=2, const char * szFile=0x01f56550, int nLine=13466, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x0012e8c4)  Line 420 + 0x28 bytes    C msvcr80d.dll!_CrtDbgReportV(int nRptType=2, const char * szFile=0x01f56550, int nLine=13466, const char * szModule=0x00000000, const char * szFormat=0x00000000, char * arglist=0x0012e8c4)  Line 300 + 0x1d bytes    C msvcr80d.dll!_CrtDbgReport(int nRptType=2, const char * szFile=0x01f56550, int nLine=13466, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Line 317 + 0x1d bytes    C mfc80d.dll!AfxAssertFailedLine(const char * lpszFileName=0x01f56550, int nLine=13466)  Line 25 + 0x14 bytes    C++ ProfUIS287md.dll!CExtBarNcAreaButton::IsBarAutoHideMode(bool * p_bDisplayed=0x0012e93f, bool * p_bActive=0x00000000)  Line 13466 + 0x2a bytes    C++ ProfUIS287md.dll!CExtBarNcAreaButton::OnQueryVisibility()  Line 13816 + 0xe bytes    C++ ProfUIS287md.dll!CExtBarNcAreaButtonClose::OnQueryVisibility()  Line 14553 + 0x8 bytes    C++ ProfUIS287md.dll!CExtControlBar::OnNcAreaButtonsReposition()  Line 13368 + 0xf bytes    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::OnSize(unsigned int nType=0, int cx=0, int cy=0)  Line 1598 + 0x12 bytes    C++ mfc80d.dll!CWnd::OnWndMsg(unsigned int message=5, unsigned int wParam=0, long lParam=0, long * pResult=0x0012ebd4)  Line 2052    C++ mfc80d.dll!CWnd::WindowProc(unsigned int message=5, unsigned int wParam=0, long lParam=0)  Line 1741 + 0x20 bytes    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::WindowProc(unsigned int message=5, unsigned int wParam=0, long lParam=0)  Line 2364 + 0x14 bytes    C++ mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x39d71560, HWND__ * hWnd=0x001521e0, unsigned int nMsg=5, unsigned int wParam=0, long lParam=0)  Line 240 + 0x1c bytes    C++ mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x001521e0, unsigned int nMsg=5, unsigned int wParam=0, long lParam=0)  Line 389    C++ mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x001521e0, unsigned int nMsg=5, unsigned int wParam=0, long lParam=0)  Line 411 + 0x15 bytes    C++ user32.dll!7e418734()     user32.dll!7e418816()     user32.dll!7e428ea0()     user32.dll!7e428eec()     ntdll.dll!7c90e473()     user32.dll!7e4194be()     user32.dll!7e42f5c6()     user32.dll!7e42c228()     uxtheme.dll!5ad71af6()     user32.dll!7e42c17e()     uxtheme.dll!5ad8c2b1()     user32.dll!7e42f15c()     user32.dll!7e42c17e()     user32.dll!7e418734()     user32.dll!7e42c17e()     user32.dll!7e42c17e()     user32.dll!7e418816()     user32.dll!7e42c17e()     user32.dll!7e42c17e()     user32.dll!7e42a013()     user32.dll!7e42c17e()     user32.dll!7e42a998()     user32.dll!7e42c17e()     mfc80d.dll!CWnd::DefWindowProcA(unsigned int nMsg=71, unsigned int wParam=0, long lParam=1242224)  Line 1029 + 0x20 bytes    C++ mfc80d.dll!CWnd::Default()  Line 274    C++ mfc80d.dll!CWnd::OnWindowPosChanged(tagWINDOWPOS * __formal=0x0012f470)  Line 422 + 0xf bytes    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::OnWindowPosChanged(tagWINDOWPOS * lpwndpos=0x0012f470)  Line 1607    C++ mfc80d.dll!CWnd::OnWndMsg(unsigned int message=71, unsigned int wParam=0, long lParam=1242224, long * pResult=0x0012f240)  Line 2158    C++ mfc80d.dll!CWnd::WindowProc(unsigned int message=71, unsigned int wParam=0, long lParam=1242224)  Line 1741 + 0x20 bytes    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::WindowProc(unsigned int message=71, unsigned int wParam=0, long lParam=1242224)  Line 2364 + 0x14 bytes    C++ mfc80d.dll!AfxCallWndProc(CWnd * pWnd=0x39d71560, HWND__ * hWnd=0x001521e0, unsigned int nMsg=71, unsigned int wParam=0, long lParam=1242224)  Line 240 + 0x1c bytes    C++ mfc80d.dll!AfxWndProc(HWND__ * hWnd=0x001521e0, unsigned int nMsg=71, unsigned int wParam=0, long lParam=1242224)  Line 389    C++ mfc80d.dll!AfxWndProcBase(HWND__ * hWnd=0x001521e0, unsigned int nMsg=71, unsigned int wParam=0, long lParam=1242224)  Line 411 + 0x15 bytes    C++ user32.dll!7e418734()     user32.dll!7e42bdf1()     user32.dll!7e428ea0()     user32.dll!7e42be3b()     ntdll.dll!7c90e473()     user32.dll!7e4299ff()     mfc80d.dll!CWnd::SetWindowPos(const CWnd * pWndInsertAfter=0x00000000, int x=0, int y=0, int cx=6, int cy=23, unsigned int nFlags=22)  Line 322 + 0x2a bytes    C++ mfc80d.dll!CFrameWnd::RecalcLayout(int bNotify=1)  Line 2032    C++ mfc80d.dll!CMiniDockFrameWnd::RecalcLayout(int bNotify=1)  Line 830    C++ ProfUIS287md.dll!CExtMiniDockFrameWnd::RecalcLayout(int bNotify=1)  Line 2408    C++ ProfUIS287md.dll!CExtControlBar::FloatControlBar(CPoint ptFloat={...}, unsigned long dwStyle=8196)  Line 19632 + 0x14 bytes    C++

 

 


 

Technical Support May 11, 2010 - 12:54 PM

Thank you for reporting this issue. Please update the source code for the following method:

bool CExtBarNcAreaButton::IsBarAutoHideMode(
            bool * p_bDisplayed, // = NULL
            bool * p_bActive // = NULL
            ) const
{
            ASSERT_VALID( this );
            if( p_bDisplayed != NULL )
                        *p_bDisplayed = false;
            if( p_bActive != NULL )
                        *p_bActive = false;
bool bAutohide = m_pBar->AutoHideModeGet();
            if( ! bAutohide )
                        return false;
            if( p_bDisplayed != NULL || p_bActive != NULL )
            {
                        if( m_pBar->m_pDockBar == NULL )
                                    return false;
                        ASSERT_VALID( m_pBar->m_pDockBar );
                        if( ! m_pBar->m_pDockBar->IsKindOf( RUNTIME_CLASS(CExtDockBar) ) )
                                    return false;
                        CExtDynAutoHideArea * pWndAutoHideArea =
                                    ((CExtDockBar*)m_pBar->m_pDockBar)->_GetAutoHideArea();
                        ASSERT_VALID( pWndAutoHideArea );
                        if( pWndAutoHideArea->m_pWndSlider != NULL )
                        {
                                    ASSERT_VALID( pWndAutoHideArea->m_pWndSlider );
                                    if( pWndAutoHideArea->m_pWndSlider->_GetBar() == m_pBar )
                                    {
                                                if( p_bDisplayed != NULL )
                                                            *p_bDisplayed = true;
                                                if( p_bActive != NULL )
                                                            *p_bActive = pWndAutoHideArea->m_pWndSlider->m_bWndActive;
                                    }
                        }
            }
            return true;
}

Offer Har May 24, 2010 - 1:12 AM

Dear Support,


It did prevent the crash at the above location, but now it crashes in a different place:



void CFrameWnd::ShowControlBar(CControlBar* pBar, BOOL bShow, BOOL bDelay)
{
    ENSURE_VALID(pBar);
    CFrameWnd* pParentFrame = pBar->GetDockingFrame();
    ASSERT(pParentFrame->GetTopLevelParent() == GetTopLevelParent());
        // parent frame of bar must be related

    if (bDelay)
    {
        pBar->DelayShow(bShow);
        pParentFrame->DelayRecalcLayout();
    }
    else
    {
        pBar->SetWindowPos(NULL, 0, 0, 0, 0,
            SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|
            (bShow ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
        // call DelayShow to clear any contradictory DelayShow
        pBar->DelayShow(bShow);
        if (bShow || !pBar->IsFloating())
            pParentFrame->RecalcLayout(FALSE);
    }

    // show or hide the floating frame as appropriate
    if (pBar->IsFloating())
    {
        int nVisCount = pBar->m_pDockBar != NULL ?
            pBar->m_pDockBar->GetDockedVisibleCount() : bShow ? 1 : 0;
        if (nVisCount == 1 && bShow)
        {
            pParentFrame->m_nShowDelay = -1;
            if (bDelay)
            {
                pParentFrame->m_nShowDelay = SW_SHOWNA;
                pParentFrame->RecalcLayout(FALSE);
            }
            else
                pParentFrame->ShowWindow(SW_SHOWNA);
        }
        else if (nVisCount == 0)
        {
            ASSERT(!bShow);  <<<<<< THIS IS WHERE IT ASSERTS
            pParentFrame->m_nShowDelay = -1;
            if (bDelay)
                pParentFrame->m_nShowDelay = SW_HIDE;
            else
                pParentFrame->ShowWindow(SW_HIDE);
        }
        else if (!bDelay)
        {
            pParentFrame->RecalcLayout(FALSE);
        }
    }
}

This happens only if I have a control-bar in the auto-hide mode, otherwise it does not asserts there.


Thanks,


Ron.

Technical Support May 25, 2010 - 1:42 AM

Please check the auto-hidden state first. I.e. do not invoke the CFrameWnd::ShowControlBar() API for the auto-hidden bars:

CExtControlBar * pBar = . . .
CMainFrame * pMainFrame = . . .
            if( pBar->AutoHideModeGet() )
                        pBar->AutoHideModeSet( . . . ); // this API can hide the auto-hidden bar
            else
                        pMainFrame->ShowControlBar( pBar, . . . );