mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1149842 - Release the mutex for NS_OpenAnonymousTemporaryFile to prevent the deadlock. r=roc
CLOSED TREE
This commit is contained in:
parent
d7c9bcbe6d
commit
1326fa01af
@ -20,9 +20,24 @@ EncodedBufferCache::AppendBuffer(nsTArray<uint8_t> & aBuf)
|
||||
mEncodedBuffers.AppendElement()->SwapElements(aBuf);
|
||||
|
||||
if (!mTempFileEnabled && mDataSize > mMaxMemoryStorage) {
|
||||
nsresult rv = NS_OpenAnonymousTemporaryFile(&mFD);
|
||||
nsresult rv;
|
||||
PRFileDesc* tempFD = nullptr;
|
||||
{
|
||||
// Release the mMutex because there is a sync dispatch to mainthread in
|
||||
// NS_OpenAnonymousTemporaryFile.
|
||||
MutexAutoUnlock unlock(mMutex);
|
||||
rv = NS_OpenAnonymousTemporaryFile(&tempFD);
|
||||
}
|
||||
if (!NS_FAILED(rv)) {
|
||||
mTempFileEnabled = true;
|
||||
// Check the mDataSize again since we release the mMutex before.
|
||||
if (mDataSize > mMaxMemoryStorage) {
|
||||
mFD = tempFD;
|
||||
mTempFileEnabled = true;
|
||||
} else {
|
||||
// Close the tempFD because the data had been taken during the
|
||||
// MutexAutoUnlock.
|
||||
PR_Close(tempFD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user