Commit d0b25df
fix(replay): Reconfig on single-dim resizes and recycle SurfaceView bitmap on throw
Two review-bot findings:
1. determineWindowSize used && to compare new vs last-known dimensions, so
single-dimension resizes (split-screen drag, partial multi-window
adjustments, foldable transitions where only one dim shifts) were
silently dropped — onWindowSizeChanged only fired when both width AND
height differed. The new layout listener already detects single-dim
changes with ||, but then delegated to a function that AND'd them away.
Switch the existing checks to || so any size delta reconfigs the
recorder, matching the listener's intent.
2. In captureSurfaceViews, if PixelCopy.request or getLocationOnScreen
threw after svBitmap was allocated, the catch path logged the error
but never recycled the bitmap, leaking it until GC. Track the bitmap
in a nullable local that the catch block recycles, and clear it after
PixelCopy.request returns successfully so ownership transfers to the
async callback without double-recycling.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 001f3ad commit d0b25df
2 files changed
Lines changed: 13 additions & 7 deletions
File tree
- sentry-android-replay/src/main/java/io/sentry/android/replay
- screenshot
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
| 200 | + | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| |||
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
184 | 185 | | |
185 | | - | |
| 186 | + | |
186 | 187 | | |
| 188 | + | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
194 | | - | |
| 196 | + | |
195 | 197 | | |
196 | 198 | | |
197 | | - | |
| 199 | + | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
| 206 | + | |
205 | 207 | | |
206 | | - | |
| 208 | + | |
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
213 | 218 | | |
214 | 219 | | |
| 220 | + | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| |||
0 commit comments