WIN32OLE_EVENT: is sharing an event sink a bad idea?

Hi, guys!

I’m new to Ruby but so far I think it’s an awesome
language. In fact, I think I’ll try to write all my
scripts from now on in Ruby instead of Perl (^_^)

Anyways, I’m using Win32Ole v0.5.1 and I’ve run into a
problem with WIN32OLE_EVENT sinks for Internet Explorer
v6.0. In the course of my Ruby script’s automated
regression testing of a rather complicated
JavaScript/DHTML web app, various IE windows are opened
and for each IE instance I assign the same event handler
(which runs in its own thread). Now, my event handler
thread receives all the DWebBrowserEvents callbacks from
the various IE windows beautifully but when my Ruby
script finally ends, I encounter the following fatal error:

···


smoke.rb:540: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-01) [i586-mswin32]

I’m guessing that when the Ruby interpreter finally exits
and tries to clean up the multiple event sinks assigned
to the same event handler, it doesn’t realize that the
event sinks are one and the same and blows up by trying
to remove an event sink that has just been removed. Does
that sound plausible? Should I run each event handler in
its own thread instead of having a single thread handle
all events?

I’ll tinker with this a bit more but in the meantime if
any of you guys have any good ideas on how to fix or
circumvent this problem, I’d appreciate it. Thanks!

-Dan Su
dansu@alum.berkeley.edu