0

Add section about alternatives to docs/danging_ptr_guide.md

Explain that the alternative dangling ptr detector may provide
additional insight when stumped.

Change-Id: I61edfe5e6e5121af9595239e4f2a0633eaf51b79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4651516
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1164187}
This commit is contained in:
Tom Sepez
2023-06-29 17:21:45 +00:00
committed by Chromium LUCI CQ
parent 1b71e70faf
commit ac5ddb3ede

@ -22,6 +22,7 @@ See also the general instructions about the dangling pointer detector:
- [Object vended from C API](#object-vended-from-c-api)
- [Object conditionally owned](#object-conditionally-owned)
- [Fallback solution](#fallback-solution-1)
- [I can't figure out which pointer is dangling](I-can_t-figure-out-which-pointer-is-dangling)
- [FAQ - Why dangling pointers matter](#faq-why-dangling-pointers-matter)
## What to do about dangling pointers
@ -198,6 +199,15 @@ the dangling raw_ptr.
|--|--|
|`ExternalAPIDelete(ptr_);`|`ExternalAPIDelete(ptr_.ExtractAsDangling());`|
## I can't figure out which pointer is dangling
Usually this is a matter of straightforward reasoning, but should all else
fail, another option is to re-build with the alternative dangling pointer
detector as described in
[docs/dangling_ptr.md](./dangling_ptr.md#alternative-dangling-pointer-detector-experimental).
This will show the stacks for object creation, object destruction, and the
destruction of the object containing the dangling ptr member.
## FAQ - Why dangling pointers matter
Q. Gee, this is a raw pointer. Does destroying it actually do anything?