Greetings,
Can anyone tell me, why does SDL_DisplayFormat segfaults upon feeding it a
surface from png file? The code looks like this:
int loadFile(SDL_Surface **dest, char * filename, int transparency)
{
SDL_Surface *tmp;
*dest = IMG_Load(filename);
if (!*dest)
{
fprintf(stderr,"[ ! ] B??d! Nie uda?o mi si? za?adowa? pliku %s...\n",filename);
return(1);
};
// THIS does not get executed, although identify says:
// tank1.png PNG 153x101 DirectClass 8-bit 18502b 0.0u 0:01
if (transparency)
if ((*dest)->format->palette )
{
SDL_SetColorKey(*dest, (SDL_SRCCOLORKEY|SDL_RLEACCEL),
*(Uint8 *) (*dest)->pixels);
}
tmp = SDL_DisplayFormat(*dest);
// AND it segfaults here. WHY???
[...]
If anyone can provide me with some info (as docs are lacking int :/), I’d be
most grateful…
Regards,
Q.
Greetings,
Can anyone tell me, why does SDL_DisplayFormat segfaults upon feeding it a
surface from png file?
I think this has been fixed in the latest SDL release:
http://www.libsdl.org/download.html
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
._ The little penguin sat on the shore,
_ at __ watching Sam Lantinga writting his letter
~~~~~ on the memorable day of 2002/04/18 11:19
Can anyone tell me, why does SDL_DisplayFormat segfaults upon feeding it a
surface from png file?
I think this has been fixed in the latest SDL release:
http://www.libsdl.org/download.html
Hm.
I grabbed SDL 1.2.4, and recompiled my program. No change.
Here’s a backtrace of it:
Starting program: /home/yacoob/workarea/rossdos/rossdos
[New Thread 1024 (LWP 26613)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 26613)]
0x4005a944 in SDL_DisplayFormat (surface=0x804ea90) at SDL_video.c:842
842 if ( ! SDL_PublicSurface ) {
(gdb) bt
#0 0x4005a944 in SDL_DisplayFormat (surface=0x804ea90) at SDL_video.c:842
#1 0x08048ac2 in loadFile (dest=0x80491a0, filename=0x8048e7b “gfx/back.jpg”, transparency=0)
at gfx.c:39
#2 0x08048b1e in loadGfx () at gfx.c:57
#3 0x08048a2f in main () at main.c:45
A tarball with my program can be found on:
http://yacoob.dnsalias.net/rossdos-0.0.1.tgz
If anyone can help me with this, I’d be most gratefull. I continue
writting without optimization given by DisplayFormat, but I think it is
a great loss in efficency.
Regards,
Q.–
__ .--------------------------http://yacoob.dnsalias.net/cv.html---.
(oo) | Have you grepped your penguin today? |
/ / \ | |
V__V'
–.penguin#128720_____________________________________________.–’
Can anyone tell me, why does SDL_DisplayFormat segfaults upon feeding it a
surface from png file?
I think this has been fixed in the latest SDL release:
http://www.libsdl.org/download.html
Hm.
I grabbed SDL 1.2.4, and recompiled my program. No change.
Here’s a backtrace of it:
Starting program: /home/yacoob/workarea/rossdos/rossdos
[New Thread 1024 (LWP 26613)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 26613)]
0x4005a944 in SDL_DisplayFormat (surface=0x804ea90) at SDL_video.c:842
842 if ( ! SDL_PublicSurface ) {
(gdb) bt
#0 0x4005a944 in SDL_DisplayFormat (surface=0x804ea90) at SDL_video.c:842
#1 0x08048ac2 in loadFile (dest=0x80491a0, filename=0x8048e7b “gfx/back.jpg”, transparency=0)
at gfx.c:39
#2 0x08048b1e in loadGfx () at gfx.c:57
#3 0x08048a2f in main () at main.c:45
Heheh, it looks like you’re loading your graphics and asking SDL to
convert them to the display format before setting a video mode. Try
setting a video mode first.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
._ The little penguin sat on the shore,
_ at __ watching Sam Lantinga writting his letter
~~~~~ on the memorable day of 2002/04/18 17:10
Heheh, it looks like you’re loading your graphics and asking SDL to
convert them to the display format before setting a video mode. Try
setting a video mode first.
Yes, that was the issue. Apologies for bringin so irrevelant problem on
the forum ;> And thanks for help, next time I shall not code upon 4. am
Regards,
Q.–
__ .--------------------------http://yacoob.dnsalias.net/cv.html---.
(oo) | Nadesico Law: Solve problems peacefully. Gravity Blast!! |
/ / \ | |
V__V'
–.penguin#128720_____________________________________________.–’