Comments (18)
Does the XNA4 spec even allow for this? I thought you had to stop media
playback before exiting, since a separate process handles that content.
On Jun 6, 2013 9:16 AM, "Jordan S" [email protected] wrote:
When closing my game I receive:
A callback was made on a garbage collected delegate of type
'SDL2#!SDL2.SDL_mixer+MusicFinishedDelegate::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.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/90
.
from fna-mghistory.
Actually, this might be a good opportunity to get this out of someone if they don't want to poke around SDL2_mixer too much.
I'd like to port that Song implementation to libvorbisfile/OpenAL, but I failed my attempt and just left SDL2_mixer there:
https://github.com/flibitijibibo/VorbisFile-CS/issues/1
I think VorbisFile# might just be crap, which would be a shame since it seems to be the only library that uses native libvorbisfile. The code I link to in that issue should work if VorbisFile# gets it together.
from fna-mghistory.
I'm not sure if XNA recommends disposing Songs, but it sure shouldn't cause the program to crash. Shamelessly, I'm not that good of a low level programmer and have never worked with native Interops etc... Ill try to get the word around where I can though.
from fna-mghistory.
It probably won't crash on XNA4, but my guess is WMP can keep going and cause various other problems if you don't stop your media player properly. Crash, unending leak, pick your poison I suppose.
from fna-mghistory.
Actually, question: Does adding 'Media.Mediaplayer.Stop()' just before 'SDL_mixer.Mix_CloseAudio()' in SDL2_GamePlatform.Exit() resolve this? Wondering if we should just force stop the MediaPlayer when we call Game.Exit().
from fna-mghistory.
Sadly, no it does not look like it
from fna-mghistory.
Well, there's always the cop-out of making Song.OnFinishedPlaying() static... there's nothing really in there that warrants it being an instance method, so why not? 🤷
from fna-mghistory.
I am receiving a InvalidOperationException was unhandled
Collection was modified; enumeration operation may not execute. Ill try and get track trace if you want.
from fna-mghistory.
Yeah, that'd be good. I'm assuming there'd be a bit more to it than adding the 'static' keyword, but not that much...
from fna-mghistory.
My Exit method just looks like this now
public override void Exit()
{
// End the network subsystem
Net.NetworkSession.Exit();
// Destroy our window
INTERNAL_window.INTERNAL_Destroy();
// Stop the audio
Media.MediaPlayer.Stop();
// Close SDL2_mixer
SDL_mixer.Mix_CloseAudio();
}
Stack Trace:
System.InvalidOperationException was unhandled
HResult=-2146233079
Message=Collection was modified; enumeration operation may not execute.
Source=mscorlib
StackTrace:
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at Microsoft.Xna.Framework.Media.MediaPlayer.Stop() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Media\MediaPlayer.cs:line 486
at Microsoft.Xna.Framework.SDL2_GamePlatform.Exit() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GamePlatform.cs:line 156
at Microsoft.Xna.Framework.Game.Exit() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 376
at removed.Interface.Menu.MenuWindow.Update() in c:\Users\Xanather\Documents\Programming\Main\removed\removed\Interface\Menu\MenuWindow.cs:line 40
at removed.Interface.UIManager.Update() in c:\Users\Xanather\Documents\Programming\Main\removed\removed\Interface\UIManager.cs:line 83
at removed.Menu.Update() in c:\Users\Xanather\Documents\Programming\Main\removed\removed\Menu.cs:line 68
at removed.Engine.Update(GameTime gameTime) in c:\Users\Xanather\Documents\Programming\Main\removed\removed\Engine.cs:line 125
at Microsoft.Xna.Framework.Game.DoUpdate(GameTime gameTime) in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 697
at Microsoft.Xna.Framework.Game.Tick() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 505
at Microsoft.Xna.Framework.SDL2_GameWindow.INTERNAL_RunLoop() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GameWindow.cs:line 409
at Microsoft.Xna.Framework.SDL2_GamePlatform.RunLoop() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\SDL2\SDL2_GamePlatform.cs:line 139
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior) in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 437
at Microsoft.Xna.Framework.Game.Run() in c:\Users\Xanather\Documents\Programming\Libs\MonoGame\MonoGame.Framework\Game.cs:line 415
at removed.Program.Main() in c:\Users\Xanather\Documents\Programming\Main\removed\removed\Program.cs:line 16
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
from fna-mghistory.
Okay, so just closing (edit: calling .Stop() ) the MediaPlayer anytime results in this exception (so its not related to the crashing issue).
from fna-mghistory.
Does this game even work with upstream MonoGame? Almost all of the problems I'm seeing have nothing to do with MG-SDL2 specifically, and the Song itself is only different in that it uses SDL2_mixer, rather than SDL_mixer.
In fact, does WindowsGL even have a Song player? I thought only Linux had it...
from fna-mghistory.
There's some cleanup I need to do with Song, going to burn through that now. Will post again when it's committed, might fix the issue.
from fna-mghistory.
I couldnt even play/load songs correctly on WindowsDX with Windows 7. MonoGame#1766. I think I had problems with WindowsGL aswell, but I cant remember what.
from fna-mghistory.
The deconstructor might help now.
EDIT: Added it to Stop() as well.
from fna-mghistory.
Okay, thanks, testing it now.
from fna-mghistory.
It worked, now it looks like Texture.cs has a disposing issue. (the closing issue that I originally created #86 which I thought was my cause). I'm going to create another issue page.
from fna-mghistory.
Neat, and this works for my games still. Song looks a lot better now too... might be easier to navigate around if someone makes a libvorbisfile/OpenAL port.
from fna-mghistory.
Related Issues (20)
- shader normalmap not work HOT 3
- Can't run on machine without audio device HOT 9
- [OpenGL] VMware/VBox Support? HOT 7
- [MojoShader] MOJOSHADER_glSetVertexAttribDivisor causes 'System.AccessViolationException' on some computers HOT 3
- [Keyboard] Proposal for Keyboard.GetLayoutEXT() HOT 1
- Microsoft.Xna.Framework.Input.GamePad.INTERNAL_AddInstance throws "An element with the same key already exists in the dictionary" HOT 2
- Triangle color is wrong with fairly simple shader + access violation exception HOT 7
- Unable to load a texture (.PNG) from stream HOT 9
- Initialization order mishap HOT 3
- GraphicsDeviceManager never set in Game HOT 1
- GL Object Disposal Wrappers are not thread-safe HOT 3
- DynamicSoundEffectInstance behavior incompatible with XNA4 HOT 8
- OpenGL 3.2+ Core Profile support HOT 4
- Starting game in full screen bug HOT 8
- Null reference when disposing sound effect after checking sound device exists HOT 5
- [QUESTIONS] learning, using FNA HOT 3
- More spec-compliant Touch Support HOT 34
- FNA Binary Release HOT 1
- RasterizerState.MultiSampleAntiAlias not implemented HOT 8
- Set Render Target to Another Window HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fna-mghistory.