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 1722

Summary: An attempt to release NULL Direct3d surface
Product: SDL Reporter: Evgeny <y.bukhtoyarov>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Windows 7   

Description Evgeny 2013-02-14 23:46:43 UTC
Method

static void
D3D_DestroyRenderer(SDL_Renderer * renderer)

has a critical problem. It may try to release IDirect3DSurface9 surface pointed by NULL pointer. That leads to really wierd consequences on my system.

It happens when the previous call to IDirect3D9_CreateDevice() fails leaving D3D_RenderData::defaultRenderTarget uninitialized.

I was able to fix this by replacing this line:

IDirect3DSurface9_Release(data->defaultRenderTarget);

with the following:

if (data->defaultRenderTarget != NULL) {
            IDirect3DSurface9_Release(data->defaultRenderTarget);
            data->defaultRenderTarget = NULL;
        }
Comment 1 Sam Lantinga 2013-02-17 23:31:26 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/031a1fd143ec