Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: AccessViolationException when disposing WaveOut in a 64-bit application [16369]

$
0
0
I'm currently migrating my application to 64-bit and whenever I'm trying to dispose the WaveOut class, I'm getting an "AccessVoilationException" with the message "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Stacktrace:

at NAudio.Wave.WaveInterop.waveOutClose(IntPtr hWaveOut)
at NAudio.Wave.WaveOut.Dispose(Boolean disposing)
at NAudio.Wave.WaveOut.Dispose()

I've tested this with version 1.5 and 1.6 of NAudio, it only happens when I compile my application for 64-bit, 32-bit works fine.

Small codepiece where it happens:

if (wavePlayer != null)
{
this.wavePlayer.Stop();
this.wavePlayer.Dispose(); //AccessViolationException
}

Initialization of the WaveOut class:
this.wavePlayer = new WaveOut(WaveCallbackInfo.FunctionCallback());

I've also tried it with the new WaveOutEvent class in NAudio, but the problem persists.
Comments: I have a hard time reproducing this with a simple piece of code. It seems that there is some multithreading involved that causes this issue. Yes, I'm using the Mp3FileReader. As for your last question, it happend always when the song has finished and I disposed the wavePlayer, but as I said, I think it has to do with multithreading. Is the WaveOut class even threadsafe? That would mean that this issue is my fault. :)

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>