diff options
| author | 2018-03-16 17:37:33 -0700 | |
|---|---|---|
| committer | 2018-03-16 18:09:24 -0700 | |
| commit | 3b1b8affbda97b8414c3015648d7804609f727e6 (patch) | |
| tree | 50ed78d2eb16896ddbac28e5a19aaaf559812286 | |
| parent | 6e01adc9c1f22208b3d2151e7662e6defbc1d60f (diff) | |
Add a null check in case device disappears.
This is a race condition possible when the caller get display IBinder
the display is still here, but when it tries to take screenshot with
that display, the display disappeared before it.
Bug: 75324434
Test: smoke tests on walleye. This is a race so hard to verify.
Change-Id: I5a107862e0b442840038b0956736e9661f556a23
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index cb410a14e1..588cb2ab1a 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -4409,6 +4409,8 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, sp<GraphicBuf if (CC_UNLIKELY(display == 0)) return BAD_VALUE; const sp<const DisplayDevice> device(getDisplayDeviceLocked(display)); + if (CC_UNLIKELY(device == 0)) return BAD_VALUE; + DisplayRenderArea renderArea(device, sourceCrop, reqHeight, reqWidth, rotation); auto traverseLayers = std::bind(std::mem_fn(&SurfaceFlinger::traverseLayersInDisplay), this, |