src/render/direct3d/SDL_render_d3d.c
changeset 7766 84b154b1ed71
parent 7765 09937804892a
child 7828 1451063c8ecd
     1.1 --- a/src/render/direct3d/SDL_render_d3d.c	Sat Sep 28 14:07:14 2013 -0700
     1.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Sat Sep 28 14:07:17 2013 -0700
     1.3 @@ -1887,13 +1887,19 @@
     1.4  SDL_RenderGetD3D9Device(SDL_Renderer * renderer)
     1.5  {
     1.6  	D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
     1.7 +	IDirect3DDevice9 *device;
     1.8  
     1.9  	// Make sure that this is a D3D renderer
    1.10  	if (renderer->DestroyRenderer != D3D_DestroyRenderer) {
    1.11  		SDL_SetError("Renderer is not a D3D renderer");
    1.12  		return NULL;
    1.13  	}
    1.14 -	return data->device;
    1.15 +
    1.16 +	device = data->device;
    1.17 +	if (device) {
    1.18 +		IDirect3DDevice9_AddRef( device );
    1.19 +	}
    1.20 +	return device;
    1.21  }
    1.22  
    1.23  #endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */