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 - Edit null-check in SDL_render_d3d11
Summary: Edit null-check in SDL_render_d3d11
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.5
Hardware: All Windows (All)
: P2 trivial
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-14 22:04 UTC by Coriiander
Modified: 2017-08-14 22:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.