From 204bc8981f78206ad6c12ca628c59c3645ec0e0c Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Fri, 12 Mar 2021 13:16:13 +0100 Subject: [PATCH] st/nine: Fix crash on texture creation failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes regression introduced by: a179ea2e "st/nine: Use the texture memory helper" The device is used on texture/surface dtor since this commit. We need to early fill the device field in case of error. Signed-off-by: Axel Davy Acked-by: Timur Kristóf Part-of: --- src/gallium/frontends/nine/cubetexture9.c | 2 ++ src/gallium/frontends/nine/surface9.c | 1 + src/gallium/frontends/nine/texture9.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/gallium/frontends/nine/cubetexture9.c b/src/gallium/frontends/nine/cubetexture9.c index 052845b..0e87acd 100644 --- a/src/gallium/frontends/nine/cubetexture9.c +++ b/src/gallium/frontends/nine/cubetexture9.c @@ -54,6 +54,8 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This, This, pParams, EdgeLength, Levels, Usage, Format, Pool, pSharedHandle); + This->base.base.base.device = pParams->device; /* Early fill this field in case of failure */ + user_assert(EdgeLength, D3DERR_INVALIDCALL); /* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL); */ diff --git a/src/gallium/frontends/nine/surface9.c b/src/gallium/frontends/nine/surface9.c index e8479b8..e040aed 100644 --- a/src/gallium/frontends/nine/surface9.c +++ b/src/gallium/frontends/nine/surface9.c @@ -68,6 +68,7 @@ NineSurface9_ctor( struct NineSurface9 *This, /* Mark this as a special surface held by another internal resource. */ pParams->container = pContainer; + This->base.base.device = pParams->device; /* Early fill this field in case of failure */ /* Make sure there's a Desc */ assert(pDesc); diff --git a/src/gallium/frontends/nine/texture9.c b/src/gallium/frontends/nine/texture9.c index 3163b85..af0054a 100644 --- a/src/gallium/frontends/nine/texture9.c +++ b/src/gallium/frontends/nine/texture9.c @@ -56,6 +56,8 @@ NineTexture9_ctor( struct NineTexture9 *This, HRESULT hr; struct nine_allocation *user_buffer = NULL, *user_buffer_for_level; + This->base.base.base.device = pParams->device; /* Early fill this field in case of failure */ + DBG("(%p) Width=%u Height=%u Levels=%u Usage=%s Format=%s Pool=%s " "pSharedHandle=%p\n", This, Width, Height, Levels, nine_D3DUSAGE_to_str(Usage), -- 2.7.4