st/nine: Fix crash on texture creation failure

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 <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>
This commit is contained in:
Axel Davy 2021-03-12 13:16:13 +01:00 committed by Marge Bot
parent d9e79bfe4f
commit 204bc8981f
3 changed files with 5 additions and 0 deletions

View File

@ -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); */

View File

@ -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);

View File

@ -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),