From a1361fa4fc50dd34ce2503d153424f6c40ef7b4b Mon Sep 17 00:00:00 2001 From: Chris Malley Date: Tue, 23 Aug 2016 09:38:59 -0600 Subject: [PATCH] dispose of ArrowButton instances, #259 --- js/NumberControl.js | 7 ++++++- js/WavelengthSlider.js | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/js/NumberControl.js b/js/NumberControl.js index fe1cbed9a..55346c7e3 100644 --- a/js/NumberControl.js +++ b/js/NumberControl.js @@ -186,10 +186,15 @@ define( function( require ) { // @private this.disposeNumberControl = function() { + numberDisplay.dispose(); + leftArrowButton.dispose(); + rightArrowButton.dispose(); + slider.dispose(); + numberProperty.unlink( arrowEnabledListener ); thisNode.enabledProperty.unlink( enabledObserver ); - slider.dispose(); + options.tandem && options.tandem.removeInstance( thisNode ); }; diff --git a/js/WavelengthSlider.js b/js/WavelengthSlider.js index e8ab369e9..9908ae0b4 100644 --- a/js/WavelengthSlider.js +++ b/js/WavelengthSlider.js @@ -222,8 +222,10 @@ define( function( require ) { options.tandem && options.tandem.addInstance( this, TNode ); this.disposeWavelengthSlider = function() { - options.tandem && options.tandem.removeInstance( this ); + plusButton && plusButton.dispose(); + minusButton && minusButton.dispose(); wavelength.unlink( wavelengthListener ); + options.tandem && options.tandem.removeInstance( this ); }; }