I'm getting what appears to be random corruptions when I use SDL::Timer. Here are samples of the error messages generated after the program runs fine for a bit. My program runs fine for a bit, then crashes randomly, none of these are caused by bugs in the code. Disabling the use of SDL::Timer makes the crashes go away.
Not a CODE reference at /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/SDL/Event.pm line 52, <DATA> line 273. Fatal signal: Segmentation Fault (SDL Parachute Deployed) Segmentation fault Fatal signal: Segmentation Fault (SDL Parachute Deployed) Can't use an undefined value as a SCALAR reference at /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/SDL/Event.pm line 52, <DATA> line 273. Fatal signal: Segmentation Fault (SDL Parachute Deployed) Can't use string ("0") as a HASH ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/SDL/Timer.pm line 27, <DATA> line 273. Invalid option -r Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/SDL.pm line 37, <DATA> line 273. Can't return outside a subroutine during global destruction. Can't use string ("") as a subroutine ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/SDL/Event.pm line 18, <DATA> line 273. Fatal signal: Segmentation Fault (SDL Parachute Deployed) Segmentation fault Use of uninitialized value in null operation at ./test.pl line 38, <DATA> line 273. (in cleanup) Undefined subroutine &main:: called at ./test.pl line 38, <DATA> line 273. The last one didn't cause a crash, and line 38 of my script didn't even have a null operation on it (line 38 was an "if ($a != $b)"), but there was obvious corruption because that line executes fine usually. That's a warning (-w/use warnings), but the scalars being compared are never undefined. I'm still working on a good, reproducible test case, but it appears to be totally random, as is shown by the error messages above, so this is kind of tough. I've tried doing draws to the application surface in my timer callback, and just pushing events into the event queue with the following code: sub timercallback { my $e = new SDL::Event; $e->type(24); $e->push(); return 1000; } my $timer = new SDL::Timer(\&timercallback, -delay=>1000); According to the SDL documentation, you shouldn't do much more than push an event in your timer callback (http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fAddTimer): The timer callback function may run in a different thread than your main program, and so shouldn't call any functions from within itself. However, you may always call SDL_PushEvent. I assume these are "SDL threads", not "perl threads", which may be related to the source of the corruption (I have a feeling that SDL threads are not at all compatible with "perl threads", which my program is not using anyway). Really, I don't think perl or SDL should use threads unless I ask it to -- but without some kind of async execution, timers would be unimplementable anyway. Looking at the XS code for SDL::Timer related functions, other functions are definitely called, and of course, all the perl XS macros get expanded to who-knows-what, most likely they include calls to elsewhere in the perl virtual machine. So the suggestion of "shouldn't call any functions from within itself" is not held. Any ideas? -- Andy <[EMAIL PROTECTED]>