mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1166082: Check if the lock succeeded before using it. r=bschouten
This commit is contained in:
parent
f8a6b0ef50
commit
9522fd7efe
@ -746,7 +746,11 @@ CompositorD3D9::PaintToTarget()
|
||||
device()->GetRenderTargetData(backBuff, destSurf);
|
||||
|
||||
D3DLOCKED_RECT rect;
|
||||
destSurf->LockRect(&rect, nullptr, D3DLOCK_READONLY);
|
||||
HRESULT hr = destSurf->LockRect(&rect, nullptr, D3DLOCK_READONLY);
|
||||
if (FAILED(hr) || !rect.pBits) {
|
||||
gfxCriticalError() << "Failed to lock rect in paint to target D3D9 " << hexa(hr);
|
||||
return;
|
||||
}
|
||||
RefPtr<DataSourceSurface> sourceSurface =
|
||||
Factory::CreateWrappingDataSourceSurface((uint8_t*)rect.pBits,
|
||||
rect.Pitch,
|
||||
|
@ -192,9 +192,10 @@ TextureSourceD3D9::InitTextures(DeviceManagerD3D9* aDeviceManager,
|
||||
}
|
||||
|
||||
tmpTexture->GetSurfaceLevel(0, byRef(aSurface));
|
||||
aSurface->LockRect(&aLockedRect, nullptr, 0);
|
||||
if (!aLockedRect.pBits) {
|
||||
NS_WARNING("Could not lock surface");
|
||||
|
||||
HRESULT hr = aSurface->LockRect(&aLockedRect, nullptr, 0);
|
||||
if (FAILED(hr) || !aLockedRect.pBits) {
|
||||
gfxCriticalError() << "Failed to lock rect initialize texture in D3D9 " << hexa(hr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -707,7 +708,11 @@ CairoTextureClientD3D9::BorrowDrawTarget()
|
||||
// windows surface optimization.
|
||||
// Instead we have to use a gfxImageSurface and fallback for font drawing.
|
||||
D3DLOCKED_RECT rect;
|
||||
mD3D9Surface->LockRect(&rect, nullptr, 0);
|
||||
HRESULT hr = mD3D9Surface->LockRect(&rect, nullptr, 0);
|
||||
if (FAILED(hr) || !rect.pBits) {
|
||||
gfxCriticalError() << "Failed to lock rect borrowing the target in D3D9 " << hexa(hr);
|
||||
return nullptr;
|
||||
}
|
||||
mSurface = new gfxImageSurface((uint8_t*)rect.pBits, mSize,
|
||||
rect.Pitch, SurfaceFormatToImageFormat(mFormat));
|
||||
mLockRect = true;
|
||||
|
Loading…
Reference in New Issue
Block a user