
10 Nov
2007
10 Nov
'07
1:32 p.m.
Beman Dawes wrote:
std::locale global_loc = std::locale(); fs::detail::utf8_codecvt_facet utf8_facet; std::locale loc( global_loc, &utf8_facet );
Eep, don't do that! Facets are reference-counted. The locale adds a reference when you add the facet, and takes it away when it is destructed. When the count drops to zero, it tries to delete the facet. Either allocate the facet with new and pass it to the locale, or pass 1 to its constructor so that the reference counter is initialized at 1 and never drops to zero. Sebastian Redl