diff options
author | 2022-10-24 19:57:43 -0400 | |
---|---|---|
committer | 2022-10-31 17:34:15 -0400 | |
commit | 2163e410d1ad1b1a9af962f2565f676c3dbb8cb6 (patch) | |
tree | 673bc94dcb0d2bf010e2a6e94048ffcb4037fe72 /libs/hwui/AutoBackendTextureRelease.h | |
parent | 38b3e5585802378cebd48b60ece70ba6edd79586 (diff) |
Fix erroneous self deletion on SkImage creation failure
TL;DR: Skia should always call releaseProc, and maybe sooner than we thought.
There are multiple scenarios where SkImage:MakeFromTexture will fail,
returning a nullptr and calling releaseProc due to a RefCntedCallback
falling out of scope. Previously this could cause mUsageCount to fall to
0, resulting in the AutoBackendTextureRelease deleting itself even
though DeferredLayerUpdater owned a ref and expected it to still exist.
Also added logging for some reasons that could cause the later call to
MakeFromTexture to fail.
Bug: b/246831853
Test: hwui_unit_tests
Change-Id: I7fd2566b9a85fe286f72b0fc42eba5450cac69b0
Diffstat (limited to 'libs/hwui/AutoBackendTextureRelease.h')
-rw-r--r-- | libs/hwui/AutoBackendTextureRelease.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/AutoBackendTextureRelease.h b/libs/hwui/AutoBackendTextureRelease.h index c9bb767a3185..f0eb2a8b6eab 100644 --- a/libs/hwui/AutoBackendTextureRelease.h +++ b/libs/hwui/AutoBackendTextureRelease.h @@ -25,6 +25,9 @@ namespace android { namespace uirenderer { +// Friend TestUtils serves as a proxy for any test cases that require access to private members. +class TestUtils; + /** * AutoBackendTextureRelease manages EglImage/VkImage lifetime. It is a ref-counted object * that keeps GPU resources alive until the last SkImage object using them is destroyed. @@ -66,6 +69,9 @@ private: // mImage is the SkImage created from mBackendTexture. sk_sp<SkImage> mImage; + + // Friend TestUtils serves as a proxy for any test cases that require access to private members. + friend class TestUtils; }; } /* namespace uirenderer */ |