mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 914195. Improve type safety in cairo_win32_surface_create_with_d3dsurface9. r=benwa
This avoids a crash by writing to d3d9surface member on surfaces that are not win32 --HG-- extra : rebase_source : 0aa7a67151c8d30f0b57e50a1f8570abd18081ca
This commit is contained in:
parent
ad00d6aea1
commit
3e2f7faf86
@ -2115,13 +2115,15 @@ cairo_public cairo_surface_t *
|
||||
cairo_win32_surface_create_with_d3dsurface9 (IDirect3DSurface9 *surface)
|
||||
{
|
||||
HDC dc;
|
||||
cairo_win32_surface_t *win_surface;
|
||||
cairo_surface_t *win_surface;
|
||||
|
||||
IDirect3DSurface9_AddRef (surface);
|
||||
IDirect3DSurface9_GetDC (surface, &dc);
|
||||
win_surface = cairo_win32_surface_create_internal(dc, CAIRO_FORMAT_RGB24);
|
||||
win_surface->d3d9surface = surface;
|
||||
return (cairo_surface_t*) win_surface;
|
||||
if (likely(win_surface->status == CAIRO_STATUS_SUCCESS)) {
|
||||
((cairo_win32_surface_t*)win_surface)->d3d9surface = surface;
|
||||
}
|
||||
return win_surface;
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -379,7 +379,7 @@ OpaqueRenderer::Begin(LayerD3D9* aLayer)
|
||||
}
|
||||
|
||||
nsRefPtr<gfxWindowsSurface> result = new gfxWindowsSurface(mSurface);
|
||||
if (!result) {
|
||||
if (!result || result->CairoStatus()) {
|
||||
NS_WARNING("Failed to d3d9 cairo surface.");
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user