Hi Brad, Do I understand it correctly that you suggest to pass a locally-owned copy of the string into the call to VariableAccessed? If so, then I am not sure how this would solve the problem. The problem is not that def is changed by VariableAccessed, the problem is that the original char* after calling this function sometimes no longer points to a valid location in memory. Or am I missing something here?
Thanks, Yves On Tue, Mar 22, 2016 at 4:48 PM, Brad King <brad.k...@kitware.com> wrote: > On 03/22/2016 10:52 AM, Yves Frederix wrote: >> What happens is that 'def' is assigned at the beginning of the >> function, but during the call to vv->VariableAccessed(...), there is >> an internal memory re-allocation > > Thanks for tracking this down! Let's just add a > > std::string local_def = def; > > inside the variable watch block so we have a locally-owned > string to pass instead. I'm not concerned about the cost of > the local allocation because this variable watches are for > debugging anyway. > > Please look at doing that every where VariableAccessed > is called. > > Thanks, > -Brad > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers