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 CExtPropertyGridCtrl Collapse All
Subject Author Date
Offer Har Jun 20, 2007 - 2:53 AM

Dear Support.

When moving in a CExtPropertyGridCtrl to the bottom, below all the rows, into the white space, and right-click, the application crash in OnPgcContextMenuTrack:

void CExtPropertyGridCtrl::OnPgcContextMenuTrack(
	CWnd * pWndHit,
	CPoint ptScreen,
	CExtGridHitTestInfo * pHtInfo, // can be NULL
	CExtPropertyItem * pPropertyItem, // can be NULL
	CExtPropertyGridWnd * pPGW // can be NULL
	)
{
	ASSERT_VALID( this );
	ASSERT( GetSafeHwnd() != NULL );
	pWndHit;
	if( ! pPropertyItem->OnInputEnabledGet( ( pPGW != NULL ) ? pPGW->m_bInputEnabledNestedFlags : false ) )
		return;
CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;
	if( ! pPopup->CreatePopupMenu( m_hWnd ) )
	{
		ASSERT( FALSE );
		delete pPopup;
		return;
	}
...

The variable pPropertyItem is NULL, you say that it can be NULL in the comment, but there is no check for that.

Please make verify, and fix.

Thanks,
Ron.

Technical Support Jun 20, 2007 - 8:26 AM

We fixed this bug is recently. Thank you. The CExtPropertyGridCtrl::OnPgcContextMenuTrack() virtual method is invoked for tracking the popup menu over the active tree grid window inside the property grid control. This method is invoked even if a right mouse click is performed over the empty area - not over some property item. In this case, the pPropertyItem parameter is set to NULL. Please add the following two lines at the beginning of this method to fix this:

void CExtPropertyGridCtrl::OnPgcContextMenuTrack(
      CWnd * pWndHit,
      CPoint ptScreen,
      CExtGridHitTestInfo * pHtInfo, // can be NULL
      CExtPropertyItem * pPropertyItem, // can be NULL
      CExtPropertyGridWnd * pPGW // can be NULL
      )
{
      ASSERT_VALID( this );
      ASSERT( GetSafeHwnd() != NULL );
      pWndHit;
      if( pPropertyItem == NULL )   // THIS LINE WAS ADDED
            return;                 // THIS LINE WAS ADDED
. . .