Hello,
In message "Re: Won't WIN32OLE_EVENT.new leak?"
OK. I'll see if I can come up with a patch as well. I solved the
problem for my project by doing everything in a separate process,
which would have been easier if Windows supported fork(), but I guess
one can't get everything one wants...
I noticed that backword compatibility would be lost if
WIN32OLE_EVENT object is freed when WIN32OLE object is freed.
For example, the following script would not work.
def ie_start
ie = WIN32OLE.new('InternetExplorer.Application')
ie.visible = true
ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents')
ev.on_event("Quit") {|*args| $LOOP = false}
ev.on_event("BeforeNavigate") {|*args| puts args[0]}
ie = nil
GC.start
end
$LOOP = true
while $LOOP
WIN32OLE_EVENT.message_loop
end
In current Win32OLE, even if ie would be freed by GC.start,
ev is not freed. And InternetExplorer keep running.
You can control InternetExplorer interactively.
While you would keep navigating any web page,
ev keep recieving the events from InternetExplorer.
As your suggestion, if ev would be freed when ie is freed,
then there is no way to recieve the events
from InternetExplorer.
So I could find the way how to free ev
when InternetExplorer process is terminated,
but I have not found it.
Regards,
Masaki Suketa