mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1248958 - CacheIndex mRWBuf ownership too fragile, read-after-free, r=honzab
This commit is contained in:
parent
8a89aa994d
commit
ea8530a9b7
@ -347,13 +347,15 @@ CacheIndex::PreShutdown()
|
||||
nsCOMPtr<nsIRunnable> event;
|
||||
event = NS_NewRunnableMethod(index, &CacheIndex::PreShutdownInternal);
|
||||
|
||||
nsCOMPtr<nsIEventTarget> ioTarget = CacheFileIOManager::IOTarget();
|
||||
MOZ_ASSERT(ioTarget);
|
||||
RefPtr<CacheIOThread> ioThread = CacheFileIOManager::IOThread();
|
||||
MOZ_ASSERT(ioThread);
|
||||
|
||||
// PreShutdownInternal() will be executed before any queued event on INDEX
|
||||
// level. That's OK since we don't want to wait for any operation in progess.
|
||||
// We need to interrupt it and save journal as quickly as possible.
|
||||
rv = ioTarget->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
|
||||
// Executing PreShutdownInternal() on WRITE level ensures that read/write
|
||||
// events holding pointer to mRWBuf will be executed before we release the
|
||||
// buffer by calling FinishRead()/FinishWrite() in PreShutdownInternal(), but
|
||||
// it will be executed before any queued event on INDEX level. That's OK since
|
||||
// we don't want to wait until updating of the index finishes.
|
||||
rv = ioThread->Dispatch(event, CacheIOThread::WRITE);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("CacheIndex::PreShutdown() - Can't dispatch event");
|
||||
LOG(("CacheIndex::PreShutdown() - Can't dispatch event" ));
|
||||
|
Loading…
Reference in New Issue
Block a user