Bug 1454978 - Move MOZ_ASSERT(mIsMapped) into mChangeMutex. r=bas

We must check mIsMapped inside mChangeMutex or else we could run into a race condition where
the source surface is subsequently mapped again before the function terminates. This was
being hit on try.

MozReview-Commit-ID: 1eot3DVW8VD

--HG--
extra : rebase_source : 19f2514d9e2412ee5fe7c99844b7f64f78a7425e
This commit is contained in:
Ryan Hunt 2018-04-25 12:44:58 -05:00
Родитель ebb0ae9748
Коммит 2f01e497c3
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -170,18 +170,19 @@ SourceSurfaceSkia::Map(MapType, MappedSurface *aMappedSurface)
aMappedSurface->mData = GetData();
aMappedSurface->mStride = Stride();
mIsMapped = !!aMappedSurface->mData;
bool isMapped = mIsMapped;
if (!mIsMapped) {
mChangeMutex.Unlock();
}
return mIsMapped;
return isMapped;
}
void
SourceSurfaceSkia::Unmap()
{
mChangeMutex.Unlock();
MOZ_ASSERT(mIsMapped);
mIsMapped = false;
mChangeMutex.Unlock();
}
void