Subject: [Boost-bugs] [Boost C++ Libraries] #6690: access violation using global path object
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-16 10:04:10
#6690: access violation using global path object
------------------------------+---------------------------------------------
Reporter: Claudio Bley | Owner: bemandawes
Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
Version: Boost 1.49.0 | Severity: Regression
Keywords: |
------------------------------+---------------------------------------------
I think this is an instance of "static initialization order fiasco".
The following code crashes with "Access violation reading location
0x00000000".
{{{
#!cpp
#include <boost/filesystem.hpp>
#include <iostream>
const boost::filesystem::path p("test");
int main(int argc, char *argv[])
{
std::cout << p << std::endl;
}
}}}
This is caused by ```codecvt_facet``` not being initialised on its first
use. Call Stack:
{{{
fspath.exe!std::codecvt<wchar_t,char,int>::in(int & _State, const char *
_First1, const char * _Last1, const char * & _Mid1, wchar_t * _First2,
wchar_t * _Last2, wchar_t * & _Mid2) Line 1521 + 0x1f bytes C++
fspath.exe!`anonymous namespace'::convert_aux(const char * from, const
char * from_end, wchar_t * to, wchar_t * to_end,
std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & target, const std::codecvt<wchar_t,char,int> & cvt) Line 84 + 0x24
bytes C++
fspath.exe!boost::filesystem3::path_traits::convert(const char * from,
const char * from_end,
std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & to, const std::codecvt<wchar_t,char,int> & cvt) Line 165 + 0x20 bytes
C++
fspath.exe!boost::filesystem3::path_traits::dispatch<std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> >(const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > & c,
std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
> & to, const std::codecvt<wchar_t,char,int> & cvt) Line 174 + 0x60 bytes
C++
fspath.exe!boost::filesystem3::path::path<char const [5]>(const char [5]&
source, void * __formal) Line 135 + 0x23 bytes C++
}}}
this == 0x00000000
Compiled with ```cl /EHsc /DEBUG /Zi /D _DEBUG /MTd
/I%localappdata%\boost\boost_1_49 fspath.cpp /link
/libpath:%localappdata%\boost\boost_1_49\lib```.
- Claudio
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6690> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC