Jump to content
  • Advertisement
Sign in to follow this  

[c#] problems with AnimationController.Dispose() after enabling multiple tracks

This topic is 4089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone. After awhile of messing around and searching these forums and google I've come up with no solution to this problem, so I'm hoping someone can help me out. After enabling multiple tracks on an AnimationController, it wont Dispose properly anymore. I get an exception that says "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." it is for line Object1AC.Dispose(); Also, If i try to call Object1AC.ResetTime(); before that, it throws the same error. If i comment out the dispose call, it throws it on Finalize(); What's causing this problem? what should I do? It only happens after Object1AC has started to advance time (ie it begins use in the render loop). If i dont start the render loop and just exit the program, it exits fine. EDIT: I think the problem may lie in the sharing of pointers/resources of the original AnimationController and Object1AC. The reason being is that if I add

to the end of
Object1AC = Object1.rootFrame.AnimationController.Clone(Object1.rootFrame.AnimationController.MaxNumberAnimationOutputs, 4, 4, Object1.rootFrame.AnimationController.MaxNumberEvents);
            //AnimationSet set = Object1AC.GetAnimationSet(2);
            Object1AC.SetTrackEnable(1, true);
            Object1AC.SetTrackSpeed(1, 1);
            Object1AC.SetTrackPriority(1, PriorityType.Low);
            Object1AC.SetTrackWeight(1, 0.5f);
            Object1AC.SetTrackAnimationSet(1, Object1AC.GetAnimationSet(2));

Object1AC.AdvanceTime throws an exception. Am I doing it wrong? Should I be cloning differently? I'm gonna continue to mess in the mean time. EDIT 2: I've found a little workaround for the time being that throws no exception. If i GC.SuppressFinalize(Object1AC); there is no exception thrown. I still dispose of the original AnimationController, but no longer dispose Object1AC. This all happens at the end of the program, so all the memory is being cleared anyway. I still would like to know if anyone else can help out, though, because I feel this is a mere workaround and not an actual solution. Thanks [Edited by - SpiegalPwns on May 11, 2007 1:39:41 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!