BUG: Crash When Closing Application That Uses ActiveX DLL (189156)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q189156 SYMPTOMS
Using Visual Basic, you create one or more ActiveX DLLs and a Standard EXE
(client) application to use the DLLs. The client application runs as
expected within the Visual Basic (IDE) environment. However, when you
compile and run the client application as an EXE, the application produces
one of the following errors upon closing:
<project name> caused an invalid page fault in
module MSVBVM50.DLL at 0137:0f059b41.
Exception: access violation (0xc0000005), Address: 0x0f059b41
CAUSE
This problem can occur when the objects you create in the DLL are not
closed properly by the client application due to a circular reference. A
circular reference occurs, for instance, in the following scenario:
A client application instantiates an object in the ActiveX DLL: the
Parent object. The Parent object creates another object in the DLL: the
Child object. The Parent object sets a property in the Child object that
allows the Child object to have a reference to the Parent object.
This creates a circular reference between the Parent and Child objects.
When the client application that created the Parent object sets its object
variable to Nothing, the Parent object does not terminate because the Child
object maintains a reference to the Parent object. The MORE INFORMATION
section below describes a specific case for this problem and provides a
solution, which is to remove the Child's reference to the Parent object
before closing the Parent object.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
REFERENCES
For more information about circular references, refer to "Dealing with
Circular References" in chapter 6, "General Principles of Component Design"
in the Visual Basic Component Tools Guide.
Modification Type: | Major | Last Reviewed: | 5/13/2003 |
---|
Keywords: | kbbug kbpending KB189156 |
---|
|