Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception with avio_alloc_context_read_packet::Invoke #47

Closed
Sebanisu opened this issue Apr 16, 2019 · 2 comments
Closed

Exception with avio_alloc_context_read_packet::Invoke #47

Sebanisu opened this issue Apr 16, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@Sebanisu
Copy link
Collaborator

Sebanisu commented Apr 16, 2019

Managed Debugging Assistant 'CallbackOnCollectedDelegate' 
  Message=Managed Debugging Assistant 'CallbackOnCollectedDelegate' : 'A callback was made on a garbage collected delegate of type 'FFmpeg.AutoGen!FFmpeg.AutoGen.avio_alloc_context_read_packet::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.'

I am unsure why but after a sound is done playing I guess the delegate is being called by avio. It doesn't happen all the time. I have seen it twice today.

I added lock around the code in the fixed statement. This should prevent any dispose from being called before the code is done executing.

The system will not let me ffmpeg.avio_context_free(&Decoder._format->pb); It causes a CTD when ever I try.

I hope the lock helps. The error is so rare.

The only reason I am using avio_read_content. Is that it is the only way I found to read ADPCM sounds out of memory.

@Sebanisu Sebanisu added the bug Something isn't working label Apr 16, 2019
@Sebanisu
Copy link
Collaborator Author

I was thinking it could be related to the Task I added. It's possible the Delegate It's complaining about is something internal to ffmpeg.autogen. He uses delegates to reference various ffmpeg calls. Though I only use avio explicitly in one place. But unsure if it gets called automatically or not.

@Sebanisu
Copy link
Collaborator Author

Sebanisu commented May 1, 2019

I think i fixed this. I had a delegate defined in a method. And sometimes the delegate would get collected before we were done with it. Though sometimes this would never happen. So now the delegate is a field of the class so it should last as long as the class does. Oh and I upgraded ffmpeg.autogen to latest version incase that had something fixed in it. I plan to test linux before my next pull request.

@Sebanisu Sebanisu closed this as completed May 1, 2019
Sebanisu added a commit to Sebanisu/OpenVIII that referenced this issue May 1, 2019
…e to look at it again. I think I fixed it.

MaKiPL#47

added null check on renderbasictext. and added a check for a null byte. As strings read from savegames are 12 bytes exaclty null and all.

set loading screen to use new name function to read strings from save games and datafiles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant