Odd behavior found in GC when terminating application

solidstate1991 laszloszeremi at outlook.com
Fri Jan 5 14:23:30 UTC 2018


I usually write my applications' main logic into one or more 
classes unless it can be avoided, and thus I often use ctors and 
dtors for initializing and cleaning up things. One of them (my 
engine) uses dtors for cleaning up things from a non-GC external 
library (SDL2, using the Derelict loader).

If I close one of the apps I've written with them, it generates 
an access violation error within the SDL2 library. This doesn't 
happen with others, probably depending on what kind of resources 
I use. However, I just found a fix to the issue: if I manually 
call the dtor of the main logic after it exited from the main 
loop and remove the call for SDL2_QUIT(), there's no issues with 
SDL2, even the time it takes to quit it back to normal instead of 
the almost instant crash upon trying to close the application.


More information about the Digitalmars-d mailing list