Re: Crash issue having multiple active_displays in a config
simon smith <si.c....@...>
Hi Mark,
toggle quoted message
Show quoted text
I'm using Visual Studio 2012, 64-bit compilation in debug. If you view the disassembly of OCIOYaml.cpp in the load function (or set a breakpoint in ~basic_string) you can see where it's destroyed as follows: { std::vector<std::string> display; 00007FFDA504E132 lea rcx,[rsp+0C28h] 00007FFDA504E13A call std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > (07FFDA4F35CAEh) 00007FFDA504E13F nop load(second, display); 00007FFDA504E140 lea rdx,[rsp+0C28h] 00007FFDA504E148 mov rcx,qword ptr [rsp+3B0h] 00007FFDA504E150 call OpenColorIO::v1::`anonymous namespace'::load (07FFDA4F357D6h) const char* displays = JoinStringEnvStyle(display).c_str(); 00007FFDA504E155 lea rdx,[rsp+0C28h] 00007FFDA504E15D lea rcx,[rsp+0C60h] 00007FFDA504E165 call OpenColorIO::v1::JoinStringEnvStyle (07FFDA4F331BBh) 00007FFDA504E16A mov qword ptr [rsp+1898h],rax 00007FFDA504E172 mov rcx,qword ptr [rsp+1898h] 00007FFDA504E17A call std::basic_string<char,std::char_traits<char>,std::allocator<char> >::c_str (07FFDA4F35EB6h) 00007FFDA504E17F mov qword ptr [rsp+0C58h],rax 00007FFDA504E187 lea rcx,[rsp+0C60h] 00007FFDA504E18F call std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> > (07FFDA4F36F82h) c->setActiveDisplays(displays); 00007FFDA504E194 mov rcx,qword ptr [c] 00007FFDA504E19C call boost::shared_ptr<OpenColorIO::v1::Config>::operator-> (07FFDA4F33972h) 00007FFDA504E1A1 mov rdx,qword ptr [rsp+0C58h] 00007FFDA504E1A9 mov rcx,rax 00007FFDA504E1AC call OpenColorIO::v1::Config::setActiveDisplays (07FFDA4F33323h) Hopefully this displays OK for you. You can see just before the c->setActiveDisplays(displays) the string destructor fires. So the pointer passed to setActiveDisplay is thus now pointing to freed memory .... This kind of makes sense - the scope is just for the return value as the object is not assigned to anything (the *contents* are, the c_str, but std::string doesn't reference count that!) but I suspect some compilers aren't so eager to destroy the returned string as Visual Studio 2012 .... Simon. On Wednesday, July 23, 2014 12:55:30 AM UTC+1, Mark Boorer wrote:
|
|