Page 1 of 1

[r1280M] Crash: Segmentation fault when closing

Posted: Mon Dec 26, 2011 22:15
by Saya-chan
I recently built GZDoom on my 64-bit Arch, and I seem to be getting a segmentation fault every time I quit. This doesn't seem to happen in ZDoom, though.

I ran gdb and attached it to a running instance of the program, I got these two lines on exiting gzdoom:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x00007fcaacc41603 in SDL_JoystickClose () from /usr/lib/libSDL-1.2.so.0
Someone at #ZDoom suggested re-running with -nojoy, but it gives the same result.

This could seem unimportant if not for the fact that it prevents configurations from being saved.

Re: [r1280M] Crash: Segmentation fault when closing

Posted: Mon Dec 26, 2011 22:49
by Gez
The problem happens in SDL code, meaning that this is not going to be possible to investigate from Windows...

Re: [r1280M] Crash: Segmentation fault when closing

Posted: Tue Dec 27, 2011 15:30
by Saya-chan
If this could be of any help, doing some investigation I found out this is caused by calling SDL_JoystickClose() after SDL_Quit(), instead of doing it the other way around.

Re: [r1280M] Crash: Segmentation fault when closing

Posted: Thu Dec 29, 2011 18:21
by Saya-chan
I have traced down the problem. In sdl/sdlglvideo.cpp, the destructor function for SDLGLVideo calls SDL_Quit(), unlike the software one, whose destructor function doesn't do that call and thus, doesn't cause any problems.

GL

Code: Select all

SDLGLVideo::~SDLGLVideo ()
{
	if (GLRenderer != NULL) GLRenderer->FlushTextures();
	SDL_Quit( );
}
Software

Code: Select all

SDLVideo::~SDLVideo ()
{
}
I suppose only the texture flushing should be left untouched :/

Re: [r1280M] Crash: Segmentation fault when closing

Posted: Thu Dec 29, 2011 18:52
by Gez
Thanks.