We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3754

Summary: Edit null-check in SDL_render_d3d11
Product: SDL Reporter: Coriiander <coriiander>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: trivial    
Priority: P2    
Version: 2.0.5   
Hardware: All   
OS: Windows (All)   

Description Coriiander 2017-08-14 22:04:22 UTC
FILE:
\SDL2-2.0.5\src\render\direct3d11\SDL_render_d3d11

FUNCTION:
static void D3D11_DestroyRenderer(SDL_Renderer * renderer)

WHAT:
1) D3D11_DestroyRenderer calls D3D11_ReleaseAll,passing the renderer as parameter.
2) D3D11_ReleaseAll releases stuff. No null-checks are performed. Return back to D3D11_DestroyRenderer 
3) D3D11_DestroyRenderer frees stuff, but does null check before free.

FIX:
Remove the null-check "if (data)" in D3D11_DestroyRenderer, or get the null-logic straight and consistent. It's messy as is.
Comment 1 Sam Lantinga 2017-08-14 22:58:22 UTC
There is indeed a check "if (data)" in D3D11_ReleaseAll().
This check needs to be in both places because they are called from different contexts, with the renderer in different states.