[Derelict2] Code SOMETIMES seg. faults!

Minas minas_mina1990 at hotmail.co.uk
Thu May 10 13:18:28 PDT 2012


I think I found it!

I have modified main:

void main()
{
	DerelictSDL.load();
	
	int val = SDL_Init(SDL_INIT_EVERYTHING);
	writeln(val);
	
	SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, 
SDL_SWSURFACE);
	writeln("ok");
	
	DerelictSDL.unload();
}

Even if I comment out "DerelictSDL.unload();", "ok" is printed, 
which means the seg. fault doesn't occur in SDL_SetVideoMode. If 
I uncomment it, it works fine. Maybe when the destructor of 
DerelictSDL (I don't know if it has one, but I think it does, 
something like a static destructor?? [My knowledge of static 
class in D is very little]) is called, it crashes.

But I think it's strange, it shouldn't happen.


More information about the Digitalmars-d-learn mailing list