Bug 1332402 - Part 2: just complain if SingletonThread is still active at shutdown r=bwc
MozReview-Commit-ID: B57cZnCuAdv
--- a/media/mtransport/nr_socket_prsock.cpp
+++ b/media/mtransport/nr_socket_prsock.cpp
@@ -109,16 +109,17 @@ nrappkit copyright:
#include "runnable_utils.h"
#include "mozilla/SyncRunnable.h"
#include "nsTArray.h"
#include "mozilla/dom/TCPSocketBinding.h"
#include "nsITCPSocketCallback.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsISocketFilter.h"
+#include "nsDebug.h"
#ifdef XP_WIN
#include "mozilla/WindowsVersion.h"
#endif
#if defined(MOZILLA_INTERNAL_API)
// csi_platform.h deep in nrappkit defines LOG_INFO and LOG_WARNING
#ifdef LOG_INFO
@@ -173,18 +174,19 @@ namespace mozilla {
#if defined(MOZILLA_INTERNAL_API)
class SingletonThreadHolder final
{
private:
~SingletonThreadHolder()
{
r_log(LOG_GENERIC,LOG_DEBUG,"Deleting SingletonThreadHolder");
- MOZ_ASSERT(!mThread, "SingletonThreads should be Released and shut down before exit!");
if (mThread) {
+ // Likely a connection is somehow being held in CC or GC
+ NS_WARNING("SingletonThreads should be Released and shut down before exit!");
mThread->Shutdown();
mThread = nullptr;
}
}
DISALLOW_COPY_ASSIGN(SingletonThreadHolder);
public:
@@ -246,17 +248,17 @@ private:
nsCOMPtr<nsIThread> mParentThread;
nsCOMPtr<nsIThread> mThread;
};
static StaticRefPtr<SingletonThreadHolder> sThread;
static void ClearSingletonOnShutdown()
{
- ClearOnShutdown(&sThread);
+ ClearOnShutdown(&sThread, ShutdownPhase::ShutdownThreads);
}
#endif
static nsIThread* GetIOThreadAndAddUse_s()
{
// Always runs on STS thread!
#if defined(MOZILLA_INTERNAL_API)
// We need to safely release this on shutdown to avoid leaks