Derelict SFML destructor crashes
Jacob Carlborg
doob at me.com
Sun Dec 16 23:25:04 PST 2012
On 2012-12-17 07:45, Nekroze wrote:
> So what i am getting here is that either A: having it in the destructor
> will work solong as the GC cleanup is called before the end of main
> because that is when sfml is unloaded OR B: I just have to have a manual
> destroy method in my class too to release the sfml objects?
You cannot trust that the GC will collect at all. Although if the
function pointers in the bindings are still active and you don't need to
rely on the order of destruction you should be pretty safe, since your
not destroying GC memory.
The safest is to either:
A. Manually call a destroy/delete function
B. Call a destroy/delete function in a scope(exit) block (basically the
same as A)
C. Use a struct and call a destroy/delete function in its destructor.
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list