I've been using the headers of Tim Blume for SDL2 for quite a while. Since some time I get a SIGSEV exception when the program closes. Everything else works as expected and I can use SDL2 and OpenGL without problems.
I don't know if the problem is with SDL2 or the headers or even somewhere else, so I start by posting here.
I could reduce the code to this minimal example. If I init the video subsystem the error is raised after the "end.".
The error shows only on Linux but not on Windows (I tested only the most recent Korora Distribution which is based on Fedora). Please refer to the signature for details.
program sdl2_test;
uses sdl2;
begin
SDL_Init( SDL_INIT_VIDEO ); // If this is omitted no exception is raised
SDL_Quit; // Does not influence the exception
end. // The Exception is raised after program execution
The call stack looks like this
#0 _dl_catch_error at :0
#1 _dlerror_run at :0
#2 dlclose at :0
#3 CleanupVendorNameEntry(0x68e5e0, 0x68e5e0) at libglxmapping.c:321
#4 __glXMappingTeardown(0, 0) at libglxmapping.c:1061
#5 __glXFini at libglx.c:2099
#6 _dl_fini at :0
#7 __run_exit_handlers at :0
#8 exit at :0
#9 __libc_start_main at :0
#10 ?? at :0
I somehow suspect libglvnd has something to do with this because the c files belong to this package.
As far as I understood it was only recently made mandatory in Fedora (I can't find where I read that) and serves an abstraction layer between multiple implementations of OpenGL (e.g. NVidia and Intel) if you have more than one display adapter. I have an NVIDIA discrete adapter but only use the internal Intel adapter. Before I tried the rpm-fusion nvidia driver but it does not make any difference to the exception.
I tried to recreate the same code in C (compiled with GCC, debugging with GDB). And I couldn't find any issues there so it also might have something to do with fpc. However I have no experience with debugging in C. Here is the source.
#include <stdlib.h>
#include <stdio.h>
#include <SDL2/SDL.h>
int main(int argc, char *argv[])
{
SDL_Init( SDL_INIT_VIDEO );
SDL_Quit();
}
gcc -Wall tmp.c -o tmp -lSDL2
Can anyone reproduce the error or have any suggestions on how to find the source of the error?
I'll attach the pascal source code including the used headers.