Professional UI Solutions
Site Map   /  Register


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 General Discussion » Close Tab Crash Collapse All
Subject Author Date
Chun Pong Lau Jul 13, 2007 - 11:09 AM

I have implemented a tab container and tab control in my application with
PROF-UIS verson 2.7.
However, when i close the tab or logout the system, the system would crash

The following is the stack trace information:

eRoom-surd.exe!CObject::IsKindOf(const CRuntimeClass * pClass=0x0080bf9c)

I use the following code to create a tab container and tab control:

I create the container object with the following codes in the MainFrm class:

typedef AExtTabPageContainerWhidbeyWnd TabContainer;
TabContainer m_TabContainer;
m_TabContainer.Create(this, CRect(0,0,0,0), AFX_IDW_PANE_FIRST)

AExtTabPageContainerWhidbeyWnd is a class extending from
In AExtTabPageContainerWhidbeyWnd, i have defined a function
OnTabWndGetTabImpl() for calling
by the CExtTabPageContainerWhidbeyWnd object to pass the tab events to my
application. This function would return an
AExtTabWnd object which extends from public CExtTWPC < CExtTabWnd > with
the following methods:
void OnTabWndSyncVisibility();
bool OnTabWndClickedItem(LONG nItemIndex, bool bButtonPressed, INT
nMouseButton, UINT nMouseEventFlags);
void OnTabWndRemoveItem( LONG nItemIndex, LONG nCount, bool bPreRemove);
bool OnTabWndItemPosChanging(LONG nItemIndex, LONG nItemNewIndex);
void OnTabWndItemPosChanged(LONG nItemIndex, LONG nItemNewIndex);

I create the tab control object with the following codes in the MainFrm

AHtmlControlBar* pHcb = (AHtmlControlBar*)
CExtDynamicBarSite::BarAlloc(_T(""), m_CmdIconNewDoc,
0, RUNTIME_CLASS(AExtDynamicControlBar), false);

AHtmlView* pHv = pHcb->Init(CExtDynamicControlBar::__EDBS_DOCUMENT, ...);

AHtmlControlBar is a class extending from CExtDynamicControlBar.
In AHtmlControlBar::Init, it will create an AHtmlView object which extends
from CHtmlView and call AHtmlView::Create to
create the view window with parent window set to pHcb AHtmlControlBar object.

With the above codes, the tabs can be created properly. However, when i
close the tab, the system would crash sometimes
with the above error. It seems the ENSURE() call in CObject::IsKindOf()
crashes the system.

When i close the tab, the TabPageContainer object would call
AExtTabWnd::OnTabWndRemoveItem, which would then call
CMainFrm::OnRemovedTab to delete the corresponding AHtmlView object. I
find that if i do not delete the AHtmlView object
in CMainFrm::OnRemovedTab, there is no crash when i close the tab.
However, when i delete the AHtmlView object, the system
would crash sometimes, especially when the html page contains AJAX and
dynamic HTML.

Would you give me some advices or solutions?

Thanks a lot

Chun Pong Lau Jul 20, 2007 - 4:08 AM

Dear Sir/Madam,

The crash happens when i remove the tab. So adding m_wndMenuBar.RemoveAllWndHooks() in CMainFrame::DestroyWindow()
is meaningless. Anyway, is there any method like RemoveWndHook() so that i can remove the hook sink for a particular tab? If so, i can call this function before i delete the AHtmlView object. I find that the error occurs when i delete the AHtmlView object as the CExtHookSink::HookChains_t::g_HookWndProc() is called automatically thereafter.

Thanks a lot

Technical Support Jul 20, 2007 - 11:09 AM

Could you send us a stripped version of your project which demonstrates the problem so we can help you out?

Technical Support Jul 16, 2007 - 1:41 PM

This problem can be caused by an incorrect sequence of method calls that are performed to terminate window hooks. The termination calls should follow in the order reverse to the order the hooks were initialized. This may occur if you are using some hook-based classes like the menu bar and tabs. Please try the following code at the beginning of the CMainFrame::DestroyWindow():

Anyway there are not enough details in your message to come to any conclusion what may cause the problem. Would you send us the full call stack or test project?