mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1117977, make script load handling during shutdown safer, r=mccr8
--HG-- extra : rebase_source : d3f3b6961c97ae1a9b67e7b00f41247c1d67eea7
This commit is contained in:
parent
ffdff69fd0
commit
c8bd9f8dee
@ -796,6 +796,8 @@ public:
|
|||||||
: mRequest(aRequest), mLoader(aLoader), mToken(nullptr)
|
: mRequest(aRequest), mLoader(aLoader), mToken(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
virtual ~NotifyOffThreadScriptLoadCompletedRunnable();
|
||||||
|
|
||||||
void SetToken(void* aToken) {
|
void SetToken(void* aToken) {
|
||||||
MOZ_ASSERT(aToken && !mToken);
|
MOZ_ASSERT(aToken && !mToken);
|
||||||
mToken = aToken;
|
mToken = aToken;
|
||||||
@ -814,6 +816,23 @@ nsScriptLoader::ProcessOffThreadRequest(nsScriptLoadRequest* aRequest, void **aO
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NotifyOffThreadScriptLoadCompletedRunnable::~NotifyOffThreadScriptLoadCompletedRunnable()
|
||||||
|
{
|
||||||
|
if (MOZ_UNLIKELY(mRequest || mLoader) && !NS_IsMainThread()) {
|
||||||
|
nsCOMPtr<nsIThread> mainThread;
|
||||||
|
NS_GetMainThread(getter_AddRefs(mainThread));
|
||||||
|
if (mainThread) {
|
||||||
|
NS_ProxyRelease(mainThread, mRequest);
|
||||||
|
NS_ProxyRelease(mainThread, mLoader);
|
||||||
|
} else {
|
||||||
|
MOZ_ASSERT(false, "We really shouldn't leak!");
|
||||||
|
// Better to leak than crash.
|
||||||
|
unused << mRequest.forget();
|
||||||
|
unused << mLoader.forget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
NotifyOffThreadScriptLoadCompletedRunnable::Run()
|
NotifyOffThreadScriptLoadCompletedRunnable::Run()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user