File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,14 @@ protected override void Dispose(bool disposing)
180180 {
181181 if ( ! IsDisposed )
182182 {
183+ for ( int i = 0 ; i < GraphicsDevice . renderTargetCount ; i += 1 )
184+ {
185+ if ( GraphicsDevice . renderTargetBindings [ i ] . RenderTarget == this )
186+ {
187+ throw new InvalidOperationException ( "Disposing target that is still bound" ) ;
188+ }
189+ }
190+
183191 IntPtr toDispose = Interlocked . Exchange ( ref glColorBuffer , IntPtr . Zero ) ;
184192 if ( toDispose != IntPtr . Zero )
185193 {
Original file line number Diff line number Diff line change @@ -224,6 +224,14 @@ protected override void Dispose(bool disposing)
224224 {
225225 if ( ! IsDisposed )
226226 {
227+ for ( int i = 0 ; i < GraphicsDevice . renderTargetCount ; i += 1 )
228+ {
229+ if ( GraphicsDevice . renderTargetBindings [ i ] . RenderTarget == this )
230+ {
231+ throw new InvalidOperationException ( "Disposing target that is still bound" ) ;
232+ }
233+ }
234+
227235 IntPtr toDispose = Interlocked . Exchange ( ref glColorBuffer , IntPtr . Zero ) ;
228236 if ( toDispose != IntPtr . Zero )
229237 {
You can’t perform that action at this time.
0 commit comments