mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Bug 744115 - Disallow dispatching events after threads shut down. r=bsmedberg
This commit is contained in:
parent
201a6fca70
commit
e9eb4eff0a
@ -270,6 +270,7 @@ void LogTerm();
|
||||
#endif
|
||||
|
||||
extern bool gXPCOMShuttingDown;
|
||||
extern bool gXPCOMThreadsShutDown;
|
||||
|
||||
namespace mozilla {
|
||||
namespace services {
|
||||
|
@ -240,6 +240,7 @@ nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
|
||||
|
||||
nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = NULL;
|
||||
bool gXPCOMShuttingDown = false;
|
||||
bool gXPCOMThreadsShutDown = false;
|
||||
|
||||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
|
||||
@ -587,6 +588,7 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
|
||||
NotifyObservers(nullptr, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID,
|
||||
nullptr);
|
||||
|
||||
gXPCOMThreadsShutDown = true;
|
||||
nsCycleCollector_shutdownThreads();
|
||||
|
||||
NS_ProcessPendingEvents(thread);
|
||||
|
@ -15,6 +15,7 @@ MOZILLA_INTERNAL_API = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../components
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../build
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/HangMonitor.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
|
||||
#define HAVE_UALARM _BSD_SOURCE || (_XOPEN_SOURCE >= 500 || \
|
||||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) && \
|
||||
@ -388,6 +389,10 @@ nsThread::Dispatch(nsIRunnable *event, uint32_t flags)
|
||||
|
||||
NS_ENSURE_ARG_POINTER(event);
|
||||
|
||||
if (gXPCOMThreadsShutDown && MAIN_THREAD != mIsMainThread) {
|
||||
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
|
||||
}
|
||||
|
||||
if (flags & DISPATCH_SYNC) {
|
||||
nsThread *thread = nsThreadManager::get()->GetCurrentThread();
|
||||
NS_ENSURE_STATE(thread);
|
||||
|
Loading…
x
Reference in New Issue
Block a user