phetsims / forces-and-motion-basics

"Forces and Motion: Basics" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/forces-and-motion-basics
GNU General Public License v3.0
7 stars 10 forks source link

Flag disposal problem #246

Closed samreid closed 7 years ago

samreid commented 7 years ago

From https://github.com/phetsims/phet-io/issues/722

@jessegreenberg said:

@mattpen I think the line flagNode && flagNode.dispose(); in https://github.com/phetsims/phet-io/issues/722#issuecomment-255418829 is part of the cause of a disposal issue in forces-and-motion-basics (221).

Can this line be removed? It seems like the only way to update the cart position or change model.stateProperty after a team wins is to press the "Reset All" button or "Return" button, and both will also trigger FlagNode disposal.

Are there wrappers where the FlagNode needs to be disposed before pressing "Reset All" or "Return"?

samreid commented 7 years ago

@mattpen replied:

@jessegreenberg

It seems like the only way to update the cart position or change model.stateProperty after a team wins is to press the "Reset All" button or "Return" button

I think this is true when using the sim itself, but we have cases where we are resetting the cart and pullers due to actions in the classroom-activity wrapper (switching tabs or restoring states). I don't think the line can simply be removed without breaking the wrapper. It looks like you may have discovered a solution in https://github.com/phetsims/phet-io/issues/722. Is this working in the general case? Should I test it in the wrapper?

jessegreenberg commented 7 years ago

I believe that the disposal was added back in https://github.com/phetsims/forces-and-motion-basics/commit/71d78d94b3d8a6188dc14d2f80f0a8271f4c8ba4 for #221. I will try to reset the cart and the sim in the classroom activity wrapper and make sure that the flag is being disposed in those cases before closing.

jessegreenberg commented 7 years ago

I verified in the classroom-activity wrapper that we are disposing the flag whenever we switch tabs or restore states. Closing.