c++ - Boost function "boost::property_tree::ini_parser::read_ini" causing "EXC_BAD_ACCESS (code=EXC_I386_GPFLT)" -
i have simple source build , executes correctly under windows 10 visual studio 2015 throws "exc_bad_access (code=exc_i386_gpflt)" under osx 10.11.3 xcode 7.2.1:
#include <boost/property_tree/ini_parser.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <iostream> using namespace std; int main(int argc, char* argv[]) { if (argc != 3) { std::cerr << "usage: program rootpath inifilename" << std::endl ; return 1; } string mainpath(argv[1]) ; string inifilename(argv[2]) ; boost::property_tree::ptree pt; try { boost::property_tree::ini_parser::read_ini(mainpath + inifilename, pt); } catch(const boost::property_tree::ptree_error &e) { cout << e.what() << endl; } return 0; }
this stack trace:
thread 1queue : com.apple.main-thread (serial) #0 0x00000001000a10c0 in std::1::basic_streambuf<char, std::1::char_traits<char> >::pubimbue(std::1::locale const&) [inlined] @ /applications/xcode?.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../include/c++/v1/streambuf:227 #1 0x00000001000a10c0 in std::1::basic_ios<char, std::1::char_traits<char> >::imbue(std::1::locale const&) [inlined] @ /applications/xcode?.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../include/c++/v1/ios:717 #2 0x00000001000a100b in void boost::property_tree::ini_parser::read_ini<boost::property_tree::basic_ptree<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> >, std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > > > >(std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> > const&, boost::property_tree::basic_ptree<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> >, std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::1::allocator<char> > > >&, std::1::locale const&) @ /users/andreagiovacchini/documents/sviluppo/boost_1_60_0/boost/property_tree/ini_parser.hpp:167 #3 0x0000000100124a36 in main @ /users/andreagiovacchini/documents/sviluppo/test/test/main.cpp:21 #4 0x00007fff857245ad in start ()
problem comes "stream.imbue(loc);" line in ini_parser.php function:
template<class ptree> void read_ini(const std::string &filename, ptree &pt, const std::locale &loc = std::locale()) { std::basic_ifstream<typename ptree::key_type::value_type> stream(filename.c_str()); if (!stream) boost_property_tree_throw(ini_parser_error( "cannot open file", filename, 0)); stream.imbue(loc); try { read_ini(stream, pt); } catch (ini_parser_error &e) { boost_property_tree_throw(ini_parser_error( e.message(), filename, e.line())); } }
since can't see how code can generate kind of problem think boost bug.
i've tryed filing bug on boost (https://svn.boost.org/trac/boost/ticket/11963) looks property_tree bugs not taken care lot
Comments
Post a Comment