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

AddController doesn't update the m_prev of head #49

Open
GoogleCodeExporter opened this issue Aug 24, 2015 · 0 comments
Open

AddController doesn't update the m_prev of head #49

GoogleCodeExporter opened this issue Aug 24, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. world.AddController(contA)
2. world.AddController(contB)
3. world.RemoveController(contA)
4. contA.Step is still called at each world step beyond this point.

Add controller never updates contA.m_prev when contB is added. Subsequently, 
RemoveController(contA) call has no effect and contA remains on the list of 
controllers.

What is the expected output? What do you see instead?

I expect contA.Step to not be called from then on.

"Patch" (excuse the non-patch nature, added lines marked with '+'):

b2World.prototype.AddController = function (c) {
+  if( this.m_controllerList !== null ) {
+    this.m_controllerList.m_prev = c;
+  }
    c.m_next = this.m_controllerList;
    c.m_prev = null;
    this.m_controllerList = c;
    c.m_world = this;
    this.m_controllerCount++;
    return c;
}

Original issue reported on code.google.com by nzaluts...@amplify.com on 27 Mar 2015 at 4:26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant