Segfault (Segmentation fault) for no reason

Pages: 1234
static initialization is the creation of your Map object & running its constructor (and therefore all constructors of all the objects it contains).

destruction is the reverse, running the destructors (dtors). But it doesn't seem like it's getting to the destruction part
And also I figured the Map mapA; problem.I had a breakline at the very first line and it somehow bugged it or something.Without that breakpoint I dont get the error.

I backtracked the chest imgAddr problem a little and it's not that.
I typed the address itself and it still cant load it.
Last edited on
I backtracked the chest imgAddr problem a little and it's not that.


So either:

1) We have not found the line that's actually crashing
or
2) The debugger is lying to you
or
3) You are misinterpretting the debugger's output


I sent you a PM with some info about the possibility of doing a screen share so I can see first-hand what's happening. If you can respond to that, that's the next thing I can think of doing.


EDIT:

Honestly I don't know what to believe on here, as you've said "the problem is this, no wait it's this, no wait again it's this" several times and have shown multiple different screenshots, some with the problem fixed, others with the problem there, and others with a completely different problem.

You are making way too many tweaks and changes for me to keep up. I have no idea what's going on anymore. If we can't do a screen share or something similar I might have to call it quits. =x



EDIT 2:

Sorry if that sounded harsh. I'm not trying to be mean, I'm just trying to explain my position. It's like I said... debugging remotely is very hard, especially when things keep changing and I can't see what's happening.
Last edited on
An update for anyone following the thread:


The segfault happens when calling into IMG_load. The string being passed in is valid, and the library was properly initialized (and returned a success code), which makes me think the problem is either:

1) With the lib itself
2) With some kind of lib version/linking conflict
3) Memory corruption


None of which I was willing to tackle today. =(

Sorry Funkist. I hope you can get it straightened out.
Funny, I really expected it to be a filename issue.

Guess you could try switching to 32bit/64 bit libs (whichever one you aren't using now) / try using SDL 2.0 if you aren't already / try a different compiler. Not much else I can say.
I've redone the whole game from scratch , using vectors and not only the game runs faster but I also fixed the seg fault by changing

1
2
3
SDL_Surface* loadedImg = IMG_Load(imgAddr);
surface = SDL_DisplayFormatAlpha(loadedImg);
SDL_FreeSurface(loadedImg);


to:
1
2
3
4
SDL_Surface* loadedImg = IMG_Load(imgAddr);
if(!loadedImg){loadedImg = NULL;}
else {surface = SDL_DisplayFormatAlpha(loadedImg);}
SDL_FreeSurface(loadedImg);


In this case if the image doesn't load properly it just doesn't render.
Thank you all for your time.
Last edited on
Topic archived. No new replies allowed.
Pages: 1234