On 11/8/16 6:26 AM, bachmeier wrote:
On Monday, 7 November 2016 at 02:22:35 UTC, Steven Schveighoffer wrote:
Imagine a resource wrapper like so:
class Foo
{
int *mem;
this() { mem = cast(int *)malloc(int.sizeof); }
~this() { .free(mem); }
}
Now, you have a problem if you do something like this:
class Bar
{
Foo foo;
~this() { delete foo; }
}
Is there a valid use case for something like this? Why would you want to
do anything inside ~this with GC memory?
Indeed, you should not. I'm saying this type of error can explain the
observed behavior.
The original post I responded to said "I don't know if the double free
problem is related to this."
-Steve