Sign in to follow this  
SpiegalPwns

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

Recommended Posts

SpiegalPwns    122
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
Object1.rootFrame.AnimationController.Dispose();



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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this