On Sunday, 25 January 2015 at 08:41:25 UTC, Bayan Rafeh wrote:
The solution was just to remove the "delete a" from the destructor if someone comes across this later. Could someone tell me why though?
The "non-reentrant" bit applies to all GC operations, really - not just allocations. Explicit deletions are forbidden as well.
Use of the "delete" keyword is discouraged, and in that context, it is also not used in a safe way. By the time B's destructor is called, the A instance might have been already collected by the garbage collector, causing a double free bug (one of the reasons to not use delete).
