Beef
Beef copied to clipboard
Deleting an object that was detected as leaked
The code below causes the error mentioned in the issue title.
class ConsoleWrite
{
private String mMsg = new .();
public this(String msg)
{
mMsg.Set(msg);
}
public void ReturnValueDiscarded()
{
ThreadPool.QueueUserWorkItem(new [=]() =>
{
Console.Write(mMsg);
} ~ delete mMsg);
delete this;
}
}
static ConsoleWrite ConsoleWrite(String msg)
{
return new ConsoleWrite(msg);
}
public static void Main()
{
while (true)
{
ConsoleWrite("Test\n");
}
}
Tested with https://github.com/beefytech/Beef/commit/2b7d0284f7891b3d82e75f814ff90000d185a62d