I am creating an SDL-OpenGL application in D. I am using the Derelict SDL binding to accomplish this.
When I am finished running my application, I want to unload SDL. To do this I run the following function:
public ~this() {
SDL_GL_DeleteContext(renderContext);
SDL_DestroyWindow(window);
}
For some reason however, that'll give me a vague segmentation fault (no traces in GDB) and return -11. Can I not destroy SDL in a destructor, do I even have to destroy SDL after use?
My constructor:
window = SDL_CreateWindow("TEST", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP);
if(window == null) {
string error = to!string(SDL_GetError());
throw new Exception(error);
}
renderContext = SDL_GL_CreateContext(window);
if(renderContext == null) {
string error = to!string(SDL_GetError());
throw new Exception(error);
}