Forum > C# > Major Cleanup bug

Major Cleanup bug

By camelot Posted 2012-05-12 15:46 Comments 2
camelot
  • Posts: 37

One moving CCSprite (Host), that sprite has two childrens sprites (Flare1 and Flare2). Both flares in infinite rotation, clockwise and conter-clockwise.
if i do:
Host.parent.removeChild(Host, true); //cleanup set to true

i get exception

System.Collections.Generic.KeyNotFoundException was unhandled
  Message=KeyNotFoundException
  StackTrace:
       at System.ThrowHelper.ThrowKeyNotFoundException()
       at System.Collections.Generic.Dictionary`2.get_Item(CCObject key)
       at cocos2d.CCActionManager.update(Single dt)
       at cocos2d.CCScheduler.tick(Single dt)
       at cocos2d.CCDirector.drawScene(GameTime gameTime)
       at cocos2d.CCDisplayLinkDirector.mainLoop(GameTime gameTime)
       at cocos2d.CCApplication.Draw(GameTime gameTime)
       at GameDelegate.Draw(GameTime gameTime)
       at Microsoft.Xna.Framework.Game.Draw(GameTime gameTime)
       at Microsoft.Xna.Framework.Game.DrawFrame()
       at Microsoft.Xna.Framework.Game.Tick()
       at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
       at Microsoft.Xna.Framework.GameHost.OnIdle()
       at Microsoft.Xna.Framework.MobileGameHost.RunOneFrame()
       at Microsoft.Xna.Framework.MobileGameHost.gameLoopTimer_Tick(Object sender, EventArgs e)
       at Microsoft.Xna.Framework.DispatcherTimerWin32.TimerElapsed(IntPtr hWnd, UInt32 uMsg, IntPtr nIDEvent, UInt32 uTime)

this bug appear not always, seems like sometimes cleanup works.

update

this is major bug. any sprite with nested animated sprites (CCAction) can throws exception after removing.

jwa@javatopia.com
  • Posts: 243
  • Location: Totally Evil Entertainment - San Diego

#1 RE: 2012-06-07 17:43

You can hack around this bug with this addition at line 375 of actions/CCActionmanager.cs

if (!m_pTargets.ContainsKey(keys[i]))
{
// http://www.cocos2d-x.org/boards/17/topics/11072
continue;
}

There are some other major bugs I’ve found in the menu handlers where null pointers or unexpected class types have caused some runtime errors. I’ll try to collect those and post as well.

jwa@javatopia.com
  • Posts: 243
  • Location: Totally Evil Entertainment - San Diego

#2 RE: 2012-07-14 18:59

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps