Hello!

I have a class similar to this one:
```
class Dummy
{

private:

    string tmpDir;

public:

    this (string fname)
    {
        tmpDir = buildPath ("/tmp", fname.baseName);
        std.file.mkdirRecurse (tmpDir);
    }

    ~this ()
    {
        close ();
    }

    void close ()
    {
        if (std.file.exists (tmpDir))
                std.file.rmdirRecurse (tmpDir);
    }
}
```

When the GC calls the classes destructor, I get a
`core.exception.InvalidMemoryOperationError@/<...>/ldc/runtime/druntime/src/core/exception.d(693):
 Invalid memory operation`

Looks like rmdirRecurse tries to allocate with the GC, and the GC doesn't like that. Is there any good way to get the temporary directory deletet automatically when the object is freed? At time, I work around this bug by calling close() manually at the appropriate time, but this feel like a rather poor solution.

Cheers,
    Matthias


Reply via email to