[SDL] Trying to understand why SDL_GetRGB() crashes
James Barrett
xucaen at gmail.com
Fri Aug 17 05:27:29 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Maarten Engels - Visual Productions wrote:
> Dear All,
>
> I keep running into situations where SDL_GetRGB() crashes my app (SIGSEGV).
> I don't understand why the call would crash; perhaps you can enlighten me
> with your ideas.
>
> Let's assume that all 4 pointer arguments are correct; I've checked this
> over and over again.
> If the first 'pixel' argument is invalid then I would expect incorrect
> results, but no crash.
> I use the call on surfaces that I have previously loaded with images from
> disk via IMG_Load().
> It might have something to do with (BMP) images with indexed colours; it
> doesn't seem to happen with 24 bitmaps.
>
> I use:
> - SDL-1.2.11
> - mingw
> - ms vista
>
> Thanks,
> Maarten Engels
>
> _
Hi, this is just a shot in the dark, and I hope I'm not wasting
bandwidth, but I wonder if perhaps the way you are calculating the
pixel's position might be grabbing uninitialized memory.. I did a
google and found this, might not be related to your problem, but could
be worth checking into..
http://www.devolution.com/pipermail/sdl/2003-July/055314.html
Also, again a shot in the dark (it's one of those mornings), does your
surface need to be locked first before accessing the pixel?
Jim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGxZQwQuDJiZ/QrH0RApMMAJ9wQTov2ZGVqRjOEIYSZV6f2ZKUXwCfbrtL
TOYrqpYi8J1/XVuNmaQkj5w=
=+Tt4
-----END PGP SIGNATURE-----
More information about the SDL
mailing list