FIX: Default OLE Container w/ Splitters Faults on View Closure (148139)
The information in this article applies to:
- The AppWizard, when used with:
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 4.2
This article was previously published under Q148139 SYMPTOMS
An AppWizard application generated with OLE Container and Splitter Window
support will generate an Access Violation when a splitter pane containing
an in-place active item is closed. The Access Violation occurs when you try
to call m_pView->AssertValid() from the COleClientItem::AssertValid()
function.
CAUSE
The AppWizard fails to add an OnDestroy() member function to the view class
to deactivate the in-place active object when the view containing the
in-place active object is destroyed. When the view containing the active
object is destroyed, the remaining view is resized. Because the object in
the destroyed view was not properly deactivated, the subsequent call to
GetInPlaceActiveObject() in the view's OnSize() function erroneously
detects an in-place active COleClientItem object.
RESOLUTION
To work around the problem, add the following handler for the WM_DESTROY
message to your view class:
void CYourView::OnDestroy()
{
CView::OnDestroy();
COleClientItem* pActiveItem =
GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
{
pActiveItem->Deactivate();
ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
}
}
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This problem has been fixed in Visual C++
version 5.0.
Modification Type: | Major | Last Reviewed: | 12/9/2003 |
---|
Keywords: | kbBug kbContainer kbfix kbNoUpdate kbVC500fix kbwizard KB148139 |
---|
|