vb6 usercontrol gives access violation when handling events
From: simmonda (simmonda_at_community.nospam)
Date: 01/19/05
- Next message: Tim B: "RE: Runtime Error 5 - Invalid Procedure call or Argument in VB"
- Previous message: Peter Huang: "RE: network error 10050 after upgrade"
- Next in thread: Peter Huang: "RE: vb6 usercontrol gives access violation when handling events"
- Reply: Peter Huang: "RE: vb6 usercontrol gives access violation when handling events"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 19 Jan 2005 02:29:01 -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 nospam/reply address misunderstandings - quite frankly the
route to getting set-up correctly is tortuous for an infrequent user of the
service and the lack of clear instructions on setting up the no-spam alias.
It is well hidden should one go direct to the newsgroups pages and even the
other MSDN pages do not make it clear. Maybe a link from the newsgroup
profile manager to register the no-spam alias would be helpful.]
- Next message: Tim B: "RE: Runtime Error 5 - Invalid Procedure call or Argument in VB"
- Previous message: Peter Huang: "RE: network error 10050 after upgrade"
- Next in thread: Peter Huang: "RE: vb6 usercontrol gives access violation when handling events"
- Reply: Peter Huang: "RE: vb6 usercontrol gives access violation when handling events"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|