Bug 1358889 - Check if mThread is around before dereferencing. r=jesup, a=gchang
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Mon, 24 Apr 2017 16:15:10 -0700
changeset 396088 db8feaa3e24bc428292b724ab7531a3726a45cc6
parent 396087 e9e0a7ff2aad25c6033f84aa28018dda1cb76d53
child 396089 8f0099c322d3120e3d1f22a9abb09753ed49326f
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, gchang
bugs1358889
milestone54.0
Bug 1358889 - Check if mThread is around before dereferencing. r=jesup, a=gchang MozReview-Commit-ID: 88ZonLVGZK9
media/mtransport/nr_socket_prsock.cpp
--- a/media/mtransport/nr_socket_prsock.cpp
+++ b/media/mtransport/nr_socket_prsock.cpp
@@ -238,17 +238,17 @@ public:
                   NS_DISPATCH_SYNC);
   }
 
   void ReleaseUse_i()
   {
     MOZ_ASSERT(mParentThread == NS_GetCurrentThread());
     nsrefcnt count = --mUseCount;
     MOZ_ASSERT(int32_t(mUseCount) >= 0, "illegal refcnt");
-    if (count == 0) {
+    if (mThread && count == 0) {
       // in-use -> idle -- no one forcing it to remain instantiated
       r_log(LOG_GENERIC,LOG_DEBUG,"Shutting down wrapped SingletonThread %p",
             mThread.get());
       mThread->Shutdown();
       mThread = nullptr;
       // It'd be nice to use a timer instead...  But be careful of
       // xpcom-shutdown-threads in that case
     }