diff options
| author | 2022-07-12 13:55:44 -0700 | |
|---|---|---|
| committer | 2022-07-12 15:05:59 -0700 | |
| commit | 166c7217f45d312f026ea2be94101e7b39b6a2c5 (patch) | |
| tree | 213ca692b1554c8442d53696b7d81a330503457d /libs/androidfw/StringPool.cpp | |
| parent | bfd0db182e9600a401328fa6487dde9eefad3c1b (diff) | |
Don't crash after unsetting char[] in TextView
TextView.setText(char[]) is from API 1 and follows a running with
scissors API style of not copying the passed array.
To avoid a leak, in TextView.setText(String), the char[] would be nulled
out. However, an internal object could have been read using .getText()
prior to this second setText would immmediatly become a
CharSequence that crashed when you called any methods on it.
After this change, the CharWrapper will stay valid if had been
previously retrieved. The general shape of the API will be maintained.
Fixes: b/227218386
Test: atest android.widget.TextViewTest
Relnote: "Calling TextView.getText() after calling TextView.setText(char[])
will now return a valid CharSequence. The char[] pointed to by this char
sequnece may still be mutated by future calls to setText(char[]), but it
will no longer allow a (char[]) null to be set, which lead to crashes
when reading CharSequence returned from getText on TextView."
Change-Id: I35a2a76d58ec1946dace2f615cacf6a6085efdeb
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions