Skip to content

Commit dba7062

Browse files
minaripenguinGhosuto
authored andcommitted
hwui: Prevent a null pointer on renderthread
02-13 18:30:27.831 22315 22315 F DEBUG : Cause: null pointer dereference 02-13 18:30:27.831 22315 22315 F DEBUG : x0 b400007ada6a6600 x1 0000007aea3d4a10 x2 b400007ada57a998 x3 0000000000000001 02-13 18:30:27.831 22315 22315 F DEBUG : x4 0000007aea3d3f80 x5 b400007abe1f22e0 x6 0000000000000001 x7 0000000000000010 02-13 18:30:27.831 22315 22315 F DEBUG : x8 0000000000000000 x9 d3dfa7cb4870f3e0 x10 b400007ada6a6200 x11 0000000000000019 02-13 18:30:27.831 22315 22315 F DEBUG : x12 0000000000000050 x13 0000000000000033 x14 b400007ab9559000 x15 b400007ab9559000 02-13 18:30:27.831 22315 22315 F DEBUG : x16 0000007c048d96a0 x17 0000007c26d1a2f0 x18 0000007aea2ca000 x19 b400007ada6a6600 02-13 18:30:27.831 22315 22315 F DEBUG : x20 b400007ada6a6628 x21 b400007ada6a6600 x22 b400007ad4802e90 x23 b400007ad4802e80 02-13 18:30:27.831 22315 22315 F DEBUG : x24 7ffffffffffffff8 x25 1fffffffffffffff x26 00000000ffffffff x27 b400007b61ab02a8 02-13 18:30:27.831 22315 22315 F DEBUG : x28 b400007b61ab02a8 x29 0000007aea3d47d0 02-13 18:30:27.831 22315 22315 F DEBUG : lr 0000007c173f6eb0 sp 0000007aea3d47d0 pc 0000007c173f8b40 pst 0000000020001000 02-13 18:30:27.831 22315 22315 F DEBUG : backtrace: 02-13 18:30:27.831 22315 22315 F DEBUG : #00 pc 0000000000249b40 /system/lib64/libhwui.so (android::uirenderer::AnimatorManager::pushStaging()+112) (BuildId: 31073a6e7866492366c7945e840d3e74) 02-13 18:30:27.831 22315 22315 F DEBUG : #1 pc 0000000000247eac /system/lib64/libhwui.so (android::uirenderer::AnimationContext::runRemainingAnimations(android::uirenderer::TreeInfo&)+44) (BuildId: 31073a6e7866492366c7945e840d3e74) Signed-off-by: minaripenguin <[email protected]>
1 parent 9bef5f1 commit dba7062

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

libs/hwui/AnimatorManager.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ void AnimatorManager::pushStaging() {
8686

8787
if (mCancelAllAnimators) {
8888
for (auto& animator : mAnimators) {
89-
animator->forceEndNow(mAnimationHandle->context());
89+
if (animator) {
90+
animator->forceEndNow(mAnimationHandle->context());
91+
}
9092
}
9193
mCancelAllAnimators = false;
9294
} else {
9395
for (auto& animator : mAnimators) {
94-
animator->pushStaging(mAnimationHandle->context());
96+
if (animator) {
97+
animator->pushStaging(mAnimationHandle->context());
98+
}
9599
}
96100
}
97101
}
@@ -110,7 +114,9 @@ class AnimateFunctor {
110114
*mDirtyMask |= animator->dirtyMask();
111115
bool remove = animator->animate(mContext);
112116
if (remove) {
113-
animator->detach();
117+
if (animator) {
118+
animator->detach();
119+
}
114120
} else {
115121
if (animator->isRunning()) {
116122
mInfo.out.hasAnimations = true;

libs/hwui/renderthread/DrawFrameTask.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ int DrawFrameTask::drawFrame() {
135135
void DrawFrameTask::postAndWait() {
136136
ATRACE_CALL();
137137
AutoMutex _lock(mLock);
138-
mRenderThread->queue().post([this]() { run(); });
138+
if (mRenderThread) {
139+
mRenderThread->queue().post([this]() { run(); });
140+
}
139141
mSignal.wait(mLock);
140142
}
141143

0 commit comments

Comments
 (0)