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

CallbackBase.Release() - Null reference exception #1124

@victor-david

Description

@victor-david

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions