diff options
author | Steven Moreland <smoreland@google.com> | 2021-03-31 16:05:04 +0000 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2021-04-05 17:45:18 +0000 |
commit | da75cef983fb1dc44c6221dbd35f670a885046e5 (patch) | |
tree | 6612bdfa77f6a8c1c30d922fb8e372a7476cd0a3 /libutils/String16_fuzz.cpp | |
parent | 767f264fa4a8f019f6acfce8290e10f18113a524 (diff) |
ANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION
In form, inspired by ANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION.
We get occasional bugs about sp double-ownership. When this flag is
enabled, we have:
- you must construct RefBase objects using sp<>::make
- you must construct wp<> objects by converting them to sp<>
- if you want to convert a raw pointer to an sp<> object (this is
possible since the refcount is used internally, and is used commonly
on this*), then you must use 'assertStrongRefExists' semantics which
aborts if there is no strong ref held. That is, if a client uses
std::make_shared and then calls a function which internally used to
call `sp<T>(this)`, you would now call
`sp<T>::assertStrongRefExists(this)`, and the double ownership
problem would become a runtime error.
Bug: 184190315
Test: libutils_test
Change-Id: Ie18d3146420df1808e3733027070ec234dda4e9d
Diffstat (limited to 'libutils/String16_fuzz.cpp')
0 files changed, 0 insertions, 0 deletions