Fatal Signal on SurfaceLock

Hello all,

i tried googling before posting but i wasn’t able to locate something
helpful.

i get the error: “Fatal signal: Segmentation Fault (SDL Parachute Deployed)”

when all i’m trying to do is to lock the surface.

/* initalization code here... */

if (SDL_MUSTLOCK(surface))
{
    if (SDL_LockSurface(surface) == -1)
        printf("surface could not be locked.\n");
}

SDL_UnlockSurface(surface);

SDL_Quit();   

return 0;

It compiles fine btw.

Can it be a matter of user access or is that completely irrelevant?

Which line does it crash at? How did you start SDL and initialize the
surface? Is the surface valid?

ChrisOn 5/14/05, Panos Laganakos <panos.laganakos at gmail.com> wrote:

Hello all,

i tried googling before posting but i wasn’t able to locate something
helpful.

i get the error: “Fatal signal: Segmentation Fault (SDL Parachute Deployed)”

when all i’m trying to do is to lock the surface.


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

Not sure, but you’re unlocking the surface even if you don’t lock it -
have you tried not doing that?

--Gabriel

|Gabriel wrote:
|
|Not sure, but you’re unlocking the surface even if you don’t lock it -
|have you tried not doing that?

Yes i have, it gives me the same output. Why do you think it doesn’t get
locked though? The SDL_MUSTLOCK evaluates to 1, so the
SDL_LockSurface(surface) is actually executed.

|Chris Nystrom wrote:
|
|Which line does it crash at? How did you start SDL and initialize the
|surface? Is the surface valid?

I initialize SDL as in:

if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) == -1)
printf(“Could not init SDL: %s\n”, SDL_GetError());

I just did SDL_Surface *surface; and then i just tried to lock it. I
don’t understand what do you mean if its valid though.

You just have a pointer there. It is not pointing to anything yet.

ChrisOn 5/14/05, Panos Laganakos <panos.laganakos at gmail.com> wrote:

I just did SDL_Surface *surface; and then i just tried to lock it. I
don’t understand what do you mean if its valid though.


E-Mail: Chris Nystrom
Business: http://www.shaklee.net/austin
Blog: http://conversazione.blogspot.com/
AIM: nystromchris

Yes i have, it gives me the same output. Why do you think it doesn’t get
locked though? The SDL_MUSTLOCK evaluates to 1, so the
SDL_LockSurface(surface) is actually executed.

I didn’t assume, I asked. I didn’t know SDL_MUSTLOCK evaluated to 1 in
your particular case :slight_smile:

    --Gabriel