While running a web scraping application under Mongrel we started getting a "DL::DLError too many callbacks defined" exception from winClicker.rb (which we're using to pull the static text from Javascript popups.
I finally tracked this down to two problems in winClicker.rb where DL Callback blocks are defined. The first problem is that some of the callback blocks do a "return" from within the callback. This "return" doesn't just return from the callback, it returns from the winClicker function, bypassing the normal termination of the Windows EnumWindows or EnumChildWindows call. I've fixed this by properly setting the callback return code (bContinueEnum) so that the Windows call is properly terminated. In cases where the callback was trying to return a value from the callback I simply set a Ruby variable that is initialized outside the callback. However, this didn't solve the DL::DLError problem. Turns out that the DL library keeps it's own callback table (set in the DL.callback call). After digging through the DL C source code in dl.c I noticed that there is a DL.remove_callback call which is used to remove the callback from the DL table. I've added that call to all of the winClicker.rb methods which use DL.callback and my testing confirms that I'm no longer having a problem with that exception. I've checked this fix into the 1.5 development trunk as revision 1070. David Schmidt [EMAIL PROTECTED] _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
