feliwir / feliwir/SharpAudio

Null Reference Exception after disposing and re-initializing object

Đang mở
#21 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C#
Star
194
Fork
20
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

```
if (!String.IsNullOrEmpty(_nextSongToPlay))
{
if (activeMusic!=null && activeMusic.State== SoundStreamState.Playing)
{
activeMusic.Stop();
activeMusic.Dispose();
}
activeMusic = new SoundStream(System.IO.File.OpenRead(_nextSongToPlay), musicEngine);
System.Threading.Thread.Sleep(100);
activeMusic.Volume = currentVolume;
activeMusic.Play();
_nextSongToPlay = null;
}
```

It seems that there is some kind of race condition that is triggered by calling the activeMusic.Stop(); method... without putting a System.Threading.Thread.Sleep setting the volume on the activeMusic soundstream causes a null exception to be thrown.

This exception occurs if the activeMusic soundstream is or is not disposed, but only if it was not null before creating the New soundStream

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.