Article ID: 141661 - Last Review: October 24, 2003 - Revision: 2.0 FIX: Access Violation Firing an Error Event in OLE ControlThis article was previously published under Q141661 On This PageSYMPTOMS
An access violation occurs when the error event is fired in an OLE Control.
This occurs on the first firing of an error event in Release builds and
only after several firings in Debug builds.
CAUSE
An invalid "this" pointer is being loaded off the stack on a call to
ExternalRelease() at the end of COleControl::FireEvent().
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug was corrected in Microsoft
Visual C++, 32-bit Edition, version 4.0.
MORE INFORMATION
To reproduce this problem, add the stock Error event to an OLE Control
using ClassWizard's OLE Events tab. The name given the member function to
fire the event will be FireError. In the OnLButtonDown handler of the OLE
Control, call FireError() and pass the following parameters:
FireError(CTL_E_OUTOFMEMORY, " ");
Now, run the test container, insert your control, and click the control's client area. In Release builds, this causes an access violation on the first occurrence of the event. In Debug, it takes several occurrences before the access violation is seen. Sample CodeBelow is the OnLButtonDown handler for the Circ3 tutorial sample, modified to call the error event.APPLIES TO
| Article Translations
|

Back to the top
