Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

CallbackBase.Release() - Null reference exception #1124

Open
victor-david opened this issue Jan 28, 2019 · 0 comments
Open

CallbackBase.Release() - Null reference exception #1124

victor-david opened this issue Jan 28, 2019 · 0 comments

Comments

@victor-david
Copy link

Under certain circumstances, the CallbackBase.Release() method will throw a null reference exception because (at line 75) callback.Shadow is null and therefore the attempt to call to its Dispose() method throws.

In my case (may be others, I don't know), I was attempting to dispose of an audio effect that had not been inserted into the effect chain of the mastering voice. Example:

audioCapture = new AudioCaptureEffect();
audioCaptureEffectDescriptor = new EffectDescriptor(audioCapture);
// masteringVoice.SetEffectChain(audioCaptureEffectDescriptor);

Later at app ending:

audioCapture.Dispose(); 
// or
SharpDX.Utilities.Dispose(ref audioCapture);
// throws the null ref exception

If I remove the comment above, i.e:

 masteringVoice.SetEffectChain(audioCaptureEffectDescriptor);

the shadow is created and Dispose works as expected. Maybe a simple check at line 75 to see if callback.Shadow is null before calling its Dispose method.

I realize I can work around this issue simply enough by always inserting the effect into the chain instead of doing so optionally later, but there might be other circumstances with other disposable objects for which the shadow doesn't get created.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant