Print Page | Close Window

Bug in CXTPTabClientWnd::UpdateContents().

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=4434
Printed Date: 06 October 2024 at 8:24am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Bug in CXTPTabClientWnd::UpdateContents().
Posted By: Sergey
Subject: Bug in CXTPTabClientWnd::UpdateContents().
Date Posted: 19 June 2006 at 8:57am
I think you have a bug in method:

void CXTPTabClientWnd::UpdateContents().

The method contains the following code:

if ((pChildWnd->GetStyle() & WS_VISIBLE) == WS_VISIBLE)

{

// add item

pNewItem = pFoundItem = AddItem(pChildWnd);

pFoundItem->m_hWnd = pChildWnd->GetSafeHwnd();

pFrameWnd->SendMessage(WM_XTP_NEWTABITEM, (WPARAM)pNewItem);

pNewItem->GetTabManager()->SetSelectedItem(pNewItem);

}

Method AddItem(pChildWnd) may return NULL (and I really got it!). In this case my application raises Access Violation on the next line because pFoundItem=NULL. So verification for NULL is needed:

if ((pChildWnd->GetStyle() & WS_VISIBLE) == WS_VISIBLE)

{

// add item

   pNewItem = pFoundItem = AddItem(pChildWnd);

   if (pFoundItem)
   {
      pFoundItem->m_hWnd = pChildWnd->GetSafeHwnd();

      pFrameWnd->SendMessage(WM_XTP_NEWTABITEM, (WPARAM)pNewItem);

      pNewItem->GetTabManager()->SetSelectedItem(pNewItem);

   }
}
 
This code works fine!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net