I attempt to do debug logging to a file in one of the destructors. In our application, this happens to be on the GC [Finalizer] thread (since I want to do logging in our native library that is running in a managed context - a .NET application).
The problem is, that I can't construct std::ofstream
- it crashes during construction. Seems like std::locale::facet
object is already destroyed.
I attach a screenshot with a relevant call stack, code and an exception:
The bit of code that tries to create an ofstream
object is just that:
SpatialRenderer::~SpatialRenderer()
{
// dump
std::ofstream f("dump.txt"); // <- crash at this line
// writing to f here
}
Environment: Windows 10, Visual Studio 2017 Version 15.4.5
Aucun commentaire:
Enregistrer un commentaire