sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.7k stars 638 forks source link

Flush in SharpDX.Direct3D11.DeviceContext.Dispose seems problematic #929

Closed ptahmose closed 7 years ago

ptahmose commented 7 years ago

I ran across an issue caused by the call to ClearState/Flush in the Dispose-method of SharpDX.Direct3D11.DeviceContext.Dispose.

https://github.com/sharpdx/SharpDX/blob/master/Source/SharpDX.Direct3D11/DeviceContext.cs line 614-619.

To my understanding - it cannot be assumed that calling into the Disposer means that the corresponding COM-object gets destroyed (which means - COM-reference-count reaches zero). So, why should a call to Dispose cause a Flush (which needs to be synchronized with other operations on the immediate-context).

So... I'd suggest to remove those calls to ClearState/Flush - or am I missing something?