Bug 1439525 - Reset the cursor when swapping the shmems out. r?nical draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 20 Feb 2018 15:37:49 -0500
changeset 757562 aa4575c839099402ac2e1757f906eb861882ba6c
parent 757561 9ce647109aa63be152b7a5a429ea4012b2eea80d
push id99776
push userkgupta@mozilla.com
push dateTue, 20 Feb 2018 20:38:26 +0000
reviewersnical
bugs1439525
milestone60.0a1
Bug 1439525 - Reset the cursor when swapping the shmems out. r?nical Seems like a footgun to leave mCursor pointing to some random value when the shmems have been swapped out. Currently nobody seems to be reusing one of these things after a Flush() call but this should make things work better if anybody tries. MozReview-Commit-ID: AKfN0TlIMjU
gfx/layers/wr/IpcResourceUpdateQueue.cpp
--- a/gfx/layers/wr/IpcResourceUpdateQueue.cpp
+++ b/gfx/layers/wr/IpcResourceUpdateQueue.cpp
@@ -128,16 +128,17 @@ ShmSegmentsWriter::AllocLargeChunk(size_
 
 void
 ShmSegmentsWriter::Flush(nsTArray<RefCountedShmem>& aSmallAllocs, nsTArray<ipc::Shmem>& aLargeAllocs)
 {
   MOZ_ASSERT(aSmallAllocs.IsEmpty());
   MOZ_ASSERT(aLargeAllocs.IsEmpty());
   mSmallAllocs.SwapElements(aSmallAllocs);
   mLargeAllocs.SwapElements(aLargeAllocs);
+  mCursor = 0;
 }
 
 void
 ShmSegmentsWriter::Clear()
 {
   if (mShmAllocator) {
     IpcResourceUpdateQueue::ReleaseShmems(mShmAllocator, mSmallAllocs);
     IpcResourceUpdateQueue::ReleaseShmems(mShmAllocator, mLargeAllocs);