diff --git a/js/common/view/DoubleNumberLineAccordionBox.js b/js/common/view/DoubleNumberLineAccordionBox.js index 2f15721d..d0a070a2 100644 --- a/js/common/view/DoubleNumberLineAccordionBox.js +++ b/js/common/view/DoubleNumberLineAccordionBox.js @@ -319,6 +319,8 @@ define( function( require ) { markerEditorAnimation && markerEditorAnimation.stop(); markerEditorNode.dispose(); doubleNumberLineNode.dispose(); + eraserButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 + undoButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 }; // @private required by prototype functions diff --git a/js/common/view/KeypadPanel.js b/js/common/view/KeypadPanel.js index 57d3bf04..35298f03 100644 --- a/js/common/view/KeypadPanel.js +++ b/js/common/view/KeypadPanel.js @@ -105,6 +105,12 @@ define( function( require ) { valueNode.text = valueString; valueNode.center = valueBackgroundNode.center; } ); + + // @private + this.disposeKeypadPanel = function() { + keypadNode.disposeSubtree(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 + enterButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 + }; } unitRates.register( 'KeypadPanel', KeypadPanel ); @@ -181,5 +187,12 @@ define( function( require ) { }; }; - return inherit( Panel, KeypadPanel ); + return inherit( Panel, KeypadPanel, { + + // @public + dispose: function() { + this.disposeKeypadPanel(); + Panel.prototype.dispose.call( this ); + } + } ); } ); diff --git a/js/common/view/MarkerEditorNode.js b/js/common/view/MarkerEditorNode.js index 7e6485a6..abcc1ec1 100644 --- a/js/common/view/MarkerEditorNode.js +++ b/js/common/view/MarkerEditorNode.js @@ -261,6 +261,8 @@ define( function( require ) { this.disposeMarkerEditorNode = function() { markerEditor.numeratorProperty.unlink( numeratorObserver ); markerEditor.denominatorProperty.unlink( denominatorObserver ); + numeratorEditButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 + denominatorEditButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 }; // @private fields required by prototype functions diff --git a/js/shopping/view/ShoppingQuestionNode.js b/js/shopping/view/ShoppingQuestionNode.js index 2982d8fd..4f1f61df 100644 --- a/js/shopping/view/ShoppingQuestionNode.js +++ b/js/shopping/view/ShoppingQuestionNode.js @@ -220,6 +220,7 @@ define( function( require ) { // @private cleanup that's specific to this Node this.disposeShoppingQuestionNode = function() { question.guessProperty.unlink( guessObserver ); + editButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 }; } diff --git a/js/shopping/view/ShoppingQuestionsAccordionBox.js b/js/shopping/view/ShoppingQuestionsAccordionBox.js index 8dcb7c47..e6388bc7 100644 --- a/js/shopping/view/ShoppingQuestionsAccordionBox.js +++ b/js/shopping/view/ShoppingQuestionsAccordionBox.js @@ -118,6 +118,7 @@ define( function( require ) { assert && assert( child instanceof ShoppingQuestionNode ); child.dispose(); } ); + refreshButton.dispose(); // workaround for memory leak https://github.com/phetsims/unit-rates/issues/207 }; }