On Friday, 5 January 2018 at 14:23:30 UTC, solidstate1991 wrote:
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.

The problem with this is when the GC runs, it considers everything dead to have died at the same time - parent and child objects alike - and will run the destructors in whatever order is most convenient for the GC implementation.

That means the SDL quit function may be called BEFORE other cleanup, leading to your access violation.

Indeed, what you want to do is explicitly call things that need to be done in order... in order. Can't rely on the GC to call functions in any particular way.

Reply via email to