Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Default spring config is shared yet mutable #82

Open
pingpongboss opened this issue Jan 7, 2017 · 0 comments
Open

Default spring config is shared yet mutable #82

pingpongboss opened this issue Jan 7, 2017 · 0 comments

Comments

@pingpongboss
Copy link

    SpringSystem system = SpringSystem.create();
    Spring a = system.createSpring();
    Spring b = system.createSpring();

    a.getSpringConfig().tension = 123;
    a.getSpringConfig().friction = 456;

    Log.e("REBOUND", "t: " + b.getSpringConfig().tension);
    Log.e("REBOUND", "f: " + b.getSpringConfig().friction);

In this example, both a and b share the same default SpringConfig instance. This becomes an issue when code tries to mutate the SpringConfig on a. We find that the SpringConfig on b is accidentally mutated as well.

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

No branches or pull requests

1 participant