Bug 1132366 - Correct place to call MediaKeys::Release() during shutdown. r=edwin a=lmandel
authorJW Wang <jwwang@mozilla.com>
Wed, 11 Feb 2015 23:30:00 -0500
changeset 250212 4cb81cd7b63c
parent 250211 b2add82a76ce
child 250213 e3bf6bb9b33a
push id4521
push usercpearce@mozilla.com
push date2015-03-04 01:22 +0000
treeherdermozilla-beta@8abdbdecd2d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin, lmandel
bugs1132366
milestone37.0
Bug 1132366 - Correct place to call MediaKeys::Release() during shutdown. r=edwin a=lmandel
dom/media/eme/MediaKeys.cpp
--- a/dom/media/eme/MediaKeys.cpp
+++ b/dom/media/eme/MediaKeys.cpp
@@ -53,16 +53,17 @@ MediaKeys::MediaKeys(nsPIDOMWindow* aPar
 }
 
 static PLDHashOperator
 RejectPromises(const uint32_t& aKey,
                nsRefPtr<dom::Promise>& aPromise,
                void* aClosure)
 {
   aPromise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
+  ((MediaKeys*)aClosure)->Release();
   return PL_DHASH_NEXT;
 }
 
 MediaKeys::~MediaKeys()
 {
   Shutdown();
 }
 
@@ -77,17 +78,16 @@ CopySessions(const nsAString& aKey,
 }
 
 static PLDHashOperator
 CloseSessions(const nsAString& aKey,
               nsRefPtr<MediaKeySession>& aSession,
               void* aClosure)
 {
   aSession->OnClosed();
-  ((MediaKeys*)aClosure)->Release();
   return PL_DHASH_NEXT;
 }
 
 void
 MediaKeys::Terminated()
 {
   KeySessionHashMap keySessions;
   // Remove entries during iteration will screw it. Make a copy first.