Skip Menu |

This queue is for tickets about the SDL_perl CPAN distribution.

Report information
The Basics
Id: 16985
Status: patched
Priority: 0/
Queue: SDL_perl

People
Owner: Nobody in particular
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.1.3
Fixed in: (no value)



Subject: SDL::App resize method discards new surface pointer
The SDL::App resize method includes code like: $self = \SDL::SetVideoMode($w,$h,$bpp,$flags); and then returns. Since it creates a new reference in $self instead of $self the value from SetVideoMode is effectively discarded. Now it appears that SetVideoMode always returns the same surface handle for the video surface so this doesn't make itself felt at runtime, but if SetVideoMode is ever changed so that a different surface pointer is returned then this is going to start crashing. Returning the same pointer makes this hard to test for too <sigh>. My proposed patch (also attached): --- lib/SDL/App.pm.orig 2006-01-10 14:55:35.000000000 +1100 +++ lib/SDL/App.pm 2006-01-10 15:10:39.000000000 +1100 @@ -96,7 +96,8 @@ my $flags = SDL::SurfaceFlags($$self); if ( $flags & SDL::SDL_RESIZABLE()) { my $bpp = SDL::SurfaceBitsPerPixel($$self); - $self = \SDL::SetVideoMode($w,$h,$bpp,$flags); + $$self = SDL::SetVideoMode($w,$h,$bpp,$flags) + or die "resize: ", SDL::GetError(); } }
--- lib/SDL/App.pm.orig 2006-01-10 14:55:35.000000000 +1100 +++ lib/SDL/App.pm 2006-01-10 15:10:39.000000000 +1100 @@ -96,7 +96,8 @@ my $flags = SDL::SurfaceFlags($$self); if ( $flags & SDL::SDL_RESIZABLE()) { my $bpp = SDL::SurfaceBitsPerPixel($$self); - $self = \SDL::SetVideoMode($w,$h,$bpp,$flags); + $$self = SDL::SetVideoMode($w,$h,$bpp,$flags) + or die "resize: ", SDL::GetError(); } }
Try the alpha of the new API http://search.cpan.org/~kthakore/SDL-2.3_3/