VB6 Usercontrol gives access violation when handling events
From: simmonda (Andrew.Simmonds_at_vivista.co.uk.(donotspam))
Date: 01/18/05
- Previous message: Larry: "network error 10050 after upgrade"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 18 Jan 2005 08:09:08 -0800
Hi,
I have been trying to track down a situation where the VB VM enters an
endless loop when a form is unloaded. It appears that the VM is searching a
list looking for a particular value (object?) with specific properties but is
unable to find it.
During that testing I found a situation where the VM generates an access
violation when running under the VC++ debugger (memory is being filled with
invalid values) but doesn't when running normally or under the VB IDE. This
appears to be an access to a freed object by the VB runtime.
Further investigations have led to the following very small project
containing a form and two user controls:-
Create usercontrol1 and add a label (caption "Double click me"); in the code
add
Public Event dblclick()
private sub label1_dblclick()
raiseevent dblclick
end sub
Create usercontrol2 and add an instance of usercontrol1; in the code add
public event dblclick()
private sub usercontrol11_dblclick()
raiseevent dblclick
end sub
Finally add an instance of usercontrol2 to the form and add the following code
private sub usercontrol21_dblclick()
unload me
end sub
Compile this to a .exe and run it - all seems well. Attaching the VC++
debugger to the app and re-starting it from within the debugger leads to the
access violation.
It appears that the problem manifests itself when events are bubbled through
several 'nested' controls resulting in the form performing an Unload
operation. Performing an unload without nesting of events does not exhibit
the problem.
Has anybody else come across the same or a similar problem and know what is
happening please?
My concern is that this issue when running normally leads to heap corruption
or VBVM state corruption thus causing the endless loop in the VM. Any
suggestions as to the cause of this would also be welcomed.
I have reproduced the problem on several machines which are all running VB6
SP5.
Many thanks
Andrew
[Reposted due to reply address misunderstanding]
- Previous message: Larry: "network error 10050 after upgrade"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|