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 - An attempt to release NULL Direct3d surface
Summary: An attempt to release NULL Direct3d surface
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Windows 7
: P2 critical
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-14 23:46 UTC by Evgeny
Modified: 2013-02-17 23:31 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 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