From d03f401fda2525d56db57bcb1dbd2a603cc68a2a Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Fri, 12 Mar 2021 15:07:45 +0100 Subject: [PATCH] st/nine: Improve Surface GetContainer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents a crash in wine tests. Not sure this behaviour is the correct one, but at least it'll check the IID passed is the device before returning it. Signed-off-by: Axel Davy Acked-by: Timur Kristóf Part-of: --- src/gallium/frontends/nine/surface9.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/gallium/frontends/nine/surface9.c b/src/gallium/frontends/nine/surface9.c index e040aed6f31..52a3f242e6b 100644 --- a/src/gallium/frontends/nine/surface9.c +++ b/src/gallium/frontends/nine/surface9.c @@ -339,15 +339,10 @@ NineSurface9_GetContainer( struct NineSurface9 *This, if (!ppContainer) return E_POINTER; - /* Return device for OffscreenPlainSurface, DepthStencilSurface and RenderTarget */ - if (!NineUnknown(This)->container) { - *ppContainer = NineUnknown(This)->device; - NineUnknown_AddRef(NineUnknown(*ppContainer)); - - return D3D_OK; - } - - hr = NineUnknown_QueryInterface(NineUnknown(This)->container, riid, ppContainer); + /* Use device for OffscreenPlainSurface, DepthStencilSurface and RenderTarget */ + hr = NineUnknown_QueryInterface(NineUnknown(This)->container ? + NineUnknown(This)->container : &NineUnknown(This)->device->base, + riid, ppContainer); if (FAILED(hr)) DBG("QueryInterface FAILED!\n"); return hr;