From: Christoph Bumiller Date: Wed, 12 Oct 2011 19:08:40 +0000 (+0200) Subject: d3d1x: fix refcounting of GalliumD3D11DeviceChild objects X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb884262931644340507b3abdc12c3842d3e9897;p=mesa.git d3d1x: fix refcounting of GalliumD3D11DeviceChild objects An external Release would have lowered the device reference count, but an internal reference in the context does not raise it (by design). --- diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h index 488539f1bbe..7e4ea1385bc 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_objects.h @@ -42,6 +42,12 @@ struct GalliumD3D11DeviceChild : public GalliumPrivateDataComObjectAddRef(); } + virtual ~GalliumD3D11DeviceChild() + { + if(device) + device->Release(); + } + /* The purpose of this is to avoid cyclic garbage, since this won't hold * a pointer to the device if it is only held by a pipeline binding in the immediate context * @@ -50,13 +56,11 @@ struct GalliumD3D11DeviceChild : public GalliumPrivateDataComObjectAddRef(); return GalliumPrivateDataComObject::add_ref(); } inline ULONG release() { - device->Release(); return GalliumPrivateDataComObject::release(); }