forked from OSchip/llvm-project
NULL out the "ptr_" member of shared pointers for debug and release
builds (not build and integration builds) to help catch when a shared pointer that might be in a collection class is used after the collection has been freed. llvm-svn: 149136
This commit is contained in:
parent
ecc6116950
commit
a896f574e0
|
@ -684,6 +684,15 @@ public:
|
||||||
~IntrusiveSharingPtr()
|
~IntrusiveSharingPtr()
|
||||||
{
|
{
|
||||||
release_shared();
|
release_shared();
|
||||||
|
#if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
|
||||||
|
// NULL out the pointer in objects which can help with leaks detection.
|
||||||
|
// We don't enable this for LLDB_CONFIGURATION_BUILD_AND_INTEGRATION or
|
||||||
|
// when none of the LLDB_CONFIGURATION_XXX macros are defined since
|
||||||
|
// those would be builds for release. But for debug and release builds
|
||||||
|
// that are for development, we NULL out the pointers to catch potential
|
||||||
|
// issues.
|
||||||
|
ptr_ = NULL;
|
||||||
|
#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
|
||||||
}
|
}
|
||||||
|
|
||||||
T&
|
T&
|
||||||
|
|
Loading…
Reference in New Issue