From 7236b09a4db539999cd2b1a2080e234cc2d0ab5c Mon Sep 17 00:00:00 2001 From: James Cheng Date: Mon, 31 Jul 2017 11:23:29 +0800 Subject: [PATCH] Bug 1384578 - Adjust the calling sequence to avoid app crash by race condition. r=jolin MozReview-Commit-ID: JKtfNYTTCjp --HG-- extra : rebase_source : 526f6dd42de7170fd7baf49817e6c721245314fb --- dom/media/hls/HLSDemuxer.cpp | 8 ++++---- dom/media/hls/HLSResource.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dom/media/hls/HLSDemuxer.cpp b/dom/media/hls/HLSDemuxer.cpp index e0d450f320b9..39b32ee70774 100644 --- a/dom/media/hls/HLSDemuxer.cpp +++ b/dom/media/hls/HLSDemuxer.cpp @@ -253,14 +253,14 @@ HLSDemuxer::~HLSDemuxer() { HLS_DEBUG("HLSDemuxer", "~HLSDemuxer()"); mCallbackSupport->Detach(); - if (mJavaCallbacks) { - HLSDemuxerCallbacksSupport::DisposeNative(mJavaCallbacks); - mJavaCallbacks = nullptr; - } if (mHLSDemuxerWrapper) { mHLSDemuxerWrapper->Destroy(); mHLSDemuxerWrapper = nullptr; } + if (mJavaCallbacks) { + HLSDemuxerCallbacksSupport::DisposeNative(mJavaCallbacks); + mJavaCallbacks = nullptr; + } mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__); } diff --git a/dom/media/hls/HLSResource.cpp b/dom/media/hls/HLSResource.cpp index f3130338871b..427c93f3991b 100644 --- a/dom/media/hls/HLSResource.cpp +++ b/dom/media/hls/HLSResource.cpp @@ -100,14 +100,14 @@ HLSResource::~HLSResource() mCallbackSupport->Detach(); mCallbackSupport = nullptr; } - if (mJavaCallbacks) { - HLSResourceCallbacksSupport::DisposeNative(mJavaCallbacks); - mJavaCallbacks = nullptr; - } if (mHLSResourceWrapper) { mHLSResourceWrapper->Destroy(); mHLSResourceWrapper = nullptr; } + if (mJavaCallbacks) { + HLSResourceCallbacksSupport::DisposeNative(mJavaCallbacks); + mJavaCallbacks = nullptr; + } } } // namespace mozilla