boost = 1.54
IDE = Visual Studio 2005 / 2012
OS = Windows 7
Hi,
I have a 32-bit application that I am upgrading from Visual Studio 2005 to 2012. If I place the following code at the beginning of the application:
{
//test 1
boost::filesystem::path blahPath;
}
{
//test 2
boost::filesystem::path blahPath = _T( "C:\\ProgramData\\blah" );
}
{
//test 3
boost::filesystem::path blahPath;
std::wstring text = _T( "C:\\ProgramData\\blah" );
blahPath = text;
}
then it works fine in Visual Studio 2005, however test 3 crashes in Visual Studio 2012 with:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
File: f:\dd\vctools\crt_bld\self_x86\crt\src\dbgdel.cpp
Line: 52
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
and this callstack:
msvcr110d.dll!operator delete(void * pUserData) Line 52 C++
boost_filesystem-vc110-mt-gd-1_54.dll!std::allocator<wchar_t>::deallocate(wchar_t * _Ptr, unsigned int __formal) Line 586 C++
boost_filesystem-vc110-mt-gd-1_54.dll!std::_Wrap_alloc<std::allocator<wchar_t> >::deallocate(wchar_t * _Ptr, unsigned int _Count) Line 888 C++
boost_filesystem-vc110-mt-gd-1_54.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::_Tidy(bool _Built, unsigned int _Newsize) Line 2265 C++
boost_filesystem-vc110-mt-gd-1_54.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::~basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >() Line 965 C++
boost_filesystem-vc110-mt-gd-1_54.dll!boost::filesystem::path::~path() C++
blah.exe!CPlanarApp::InitInstance() Line 152 C++
mfc110ud.dll!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 37 C++
blah.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 26 C++
blah.exe!__tmainCRTStartup() Line 528 C
blah.exe!wWinMainCRTStartup() Line 377 C
kernel32.dll!75ce33aa() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!76f09ef2() Unknown
ntdll.dll!76f09ec5() Unknown
The boost::filesystem::path destructor is being called and is causing a crash. I do not understand how the first two tests can pass yet there is a problem with the third test. Is there something that I am doing wrong here or does anyone have any advice please?
Thanks,
Patrick