From 026ac1d69b8c0afb8236029a914196abf6e4e2c3 Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 8 Aug 2017 08:31:52 -0700 Subject: [PATCH] Don't release a surface until we've stopped using it ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=164596062 --- .../java/com/google/android/exoplayer2/SimpleExoPlayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java index db1b1a13f1..16a44aa016 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java @@ -762,12 +762,12 @@ public class SimpleExoPlayer implements ExoPlayer { } } if (this.surface != null && this.surface != surface) { - // If we created this surface, we are responsible for releasing it. + // We're replacing a surface. Block to ensure that it's not accessed after the method returns. + player.blockingSendMessages(messages); + // If we created the previous surface, we are responsible for releasing it. if (this.ownsSurface) { this.surface.release(); } - // We're replacing a surface. Block to ensure that it's not accessed after the method returns. - player.blockingSendMessages(messages); } else { player.sendMessages(messages); }