phetsims / build-a-molecule

"Build a Molecule" is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
8 stars 7 forks source link

Going back and forth between collections and adding molecules can crash sim #141

Closed ghost closed 4 years ago

ghost commented 4 years ago

Test Device

Hanson

Operating System

Windows 10

Browser

Chrome 79.0.3945.117

Problem Description

If you follow steps 1-6 (see steps to reproduce), you should see molecules from collection A in the play area. You can manipulate these molecules, and if you try to put them back in their bucket, the sim crashes. There is a console error when the sim crashes.

build-a-molecule_en_phet.html:1110 Uncaught TypeError: Cannot read property 'atoms' of null
    at H.value (build-a-molecule_en_phet.html:1110)
    at H.value (build-a-molecule_en_phet.html:1110)
    at C.end [as _end] (build-a-molecule_en_phet.html:1110)
    at build-a-molecule_en_phet.html:1110
    at C.onRelease (build-a-molecule_en_phet.html:1110)
    at e.value (build-a-molecule_en_phet.html:1110)
    at C.release (build-a-molecule_en_phet.html:1110)
    at C.release (build-a-molecule_en_phet.html:1110)
    at C.pointerUp (build-a-molecule_en_phet.html:1110)
    at H.value (build-a-molecule_en_phet.html:1110)

Steps to Reproduce

  1. Complete a collection, call it collection A.
  2. Move to the next collection, call it collection B.
  3. Go back to collection A.
  4. Put a molecule in the play area.
  5. Go back to collection B.
  6. Go back collection A.

Visuals

Troubleshooting Information !!!!! DO NOT EDIT !!!!! Name: ‪Build a Molecule‬ URL: https://phet-dev.colorado.edu/html/build-a-molecule/0.0.0-dev.38/phet/build-a-molecule_en_phet.html Version: 0.0.0-dev.38 2020-01-09 14:39:10 UTC Features missing: touch User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36 Language: en-US Window: 1440x821 Pixel Ratio: 1/1 WebGL: WebGL 1.0 (OpenGL ES 2.0 Chromium) GLSL: WebGL GLSL ES 1.0 (OpenGL ES GLSL ES 1.0 Chromium) Vendor: WebKit (WebKit WebGL) Vertex: attribs: 16 varying: 15 uniform: 1024 Texture: size: 16384 imageUnits: 16 (vertex: 16, combined: 80) Max viewport: 16384x16384 OES_texture_float: true Dependencies JSON: {}
Denz1994 commented 4 years ago

@lmulhall-phet Is this bug reproducible in https://phet-dev.colorado.edu/html/build-a-molecule/0.0.0-dev.39/phet/build-a-molecule_all_phet.html?

KatieWoe commented 4 years ago

It is, but the steps are a bit more involved now.

  1. Do all the steps in the issue above
  2. Try to drag the first atom around (this will start to cause odd behavior of the atoms
  3. Drag out another atom from the carousel bugstill stillbug
Denz1994 commented 4 years ago

The issue here is that when swapping collections, the previous kits weren't being reset, but their listeners were being deleted. We have to reset the kit to a clean state and then delete its listeners so when we return back to that collection's kit there aren't any lingering molecules without listeners.

Can you confirm this isn't an issue anymore in this dev version @KatieWoe?

KatieWoe commented 4 years ago

Looks good in that dev version (didn't test much beyond issue above, but looked good from what I saw). We'll keep an eye out in the next test, but I think this is good for now.

Denz1994 commented 4 years ago

Good to know. Closing this issue.