Hi, I seem to be getting myself into a lot of segmentation fault errors lately. The that currently has me stuck is one that shows up after I exit my program (an SDL App). When I need to debug I usually use the debugger or a Logger class I found and then modified, but none of them work here. The Logger doesn't work because it writes files to a folder, but since the program doesn't close cleanly the file doesn't get written. My debugger doesn't do a traceback and I don't know why. I get the segmentation fault error, the windows close, but the debugger just hangs there with no windows open. Any help finding the Segmentation fault or some reason as to why a segmentation fault would get called after everything closes would be appreciated.
caribedude
0
Newbie Poster
Recommended Answers
Jump to Posterm..... none of us are clairvoyants...
Would you like to share your code?
Jump to PostSomething that looks suspicious ...
TitleState::~TitleState() { isCurrentState=false; StartButton.OnCleanup(); SDL_FreeSurface(background); } //------------------------------------------------------------------------------ void TitleState::OnExit() { StartButton.OnCleanup(); isCurrentState=false; SDL_FreeSurface(background); }
I'd say that be sure that you don't free anything twice i.e. don't do
SDL_FreeSurface(background)
, if the 'background' has already been freed.Then change
All 8 Replies
Fbody
682
Posting Maven
Featured Poster
caribedude
0
Newbie Poster
Fbody
682
Posting Maven
Featured Poster
caribedude
0
Newbie Poster
mitrmkar
1,056
Posting Virtuoso
caribedude
0
Newbie Poster
caribedude
0
Newbie Poster
caribedude
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.