bug 1268638 - Cleanup better in failure cases. - r=jrmuizel

MozReview-Commit-ID: 661wHH47xr6
This commit is contained in:
Jeff Gilbert 2016-06-23 09:42:23 -07:00
Родитель a16d416c5a
Коммит 720e4fde9b
1 изменённых файлов: 9 добавлений и 3 удалений

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

@ -475,8 +475,10 @@ GLScreenBuffer::Attach(SharedSurface* surf, const gfx::IntSize& size)
{
ScopedBindFramebuffer autoFB(mGL);
if (mRead && SharedSurf())
const bool readNeedsUnlock = (mRead && SharedSurf());
if (readNeedsUnlock) {
SharedSurf()->UnlockProd();
}
surf->LockProd();
@ -507,7 +509,9 @@ GLScreenBuffer::Attach(SharedSurface* surf, const gfx::IntSize& size)
if (!drawOk || !readOk) {
surf->UnlockProd();
if (readNeedsUnlock) {
SharedSurf()->LockProd();
}
return false;
}
@ -550,8 +554,10 @@ GLScreenBuffer::Swap(const gfx::IntSize& size)
// attachment to framebuffer succeeds in Attach() call.
newBack->Surf()->ProducerAcquire();
if (!Attach(newBack->Surf(), size))
if (!Attach(newBack->Surf(), size)) {
newBack->Surf()->ProducerRelease();
return false;
}
// Attach was successful.
mFront = mBack;