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 when "Tabs" popup is destroyed during TrackPopupMenu Collapse All
Subject Author Date
Giacomo Ciucchi May 14, 2018 - 10:49 AM

In our code we have CExtTabWnd-derived class for CExtTabPageContainerWnd-derived container. New dialogs are created during the execution and populated as tabs using PageInsert. It is possible to click on Tabs button and get a popup with a list of all tabs added. But sometimes when such popup is open and a new dialog is created the application crashes trying to dereference a pointer to a deleted popup.



A piece from CExtPopupMenuWnd::_TrackPopupMenu:


    ASSERT_VALID( this );
    m_bCanceling = false;

    CExtPaintManager::stat_PassPaintMessages();

    ::GetCursorPos( &m_ptTrackInvoked );
    m_ptTrackWatched = m_ptTrackInvoked;

    if( _IsTopLevelPopup() )



The popup is deleted between the first and the last rows of the piece, because first ASSERT passes and the one inside _IsTopLevelPopup() fails.

CExtResizableDialog::OnInitDialog() causes the deletion, but it seems sometimes it happens at a bad time and leads to a crash. The dialogs are created in application’s main thread.



Is there a way to avoid such crashes?