From fbdfce4a61c91614ce8e3b1c8366e0c41617acc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20S=C3=A9nidre?= Date: Thu, 2 Mar 2023 22:19:51 +0100 Subject: [PATCH] fixed removeEventListener on wrong objects --- source/feathers/controls/Button.as | 5 +++-- source/feathers/controls/TextArea.as | 5 +++-- source/feathers/controls/TextInput.as | 10 ++++++---- source/feathers/controls/ToggleSwitch.as | 10 ++++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/source/feathers/controls/Button.as b/source/feathers/controls/Button.as index 55f9c7a26..943d47c1d 100644 --- a/source/feathers/controls/Button.as +++ b/source/feathers/controls/Button.as @@ -1957,9 +1957,10 @@ package feathers.controls { processStyleRestriction(key); } - if(format !== null) + var oldFormat:TextFormat = this._fontStylesSet.getFormatForState(state); + if(oldFormat !== null) { - format.removeEventListener(Event.CHANGE, changeHandler); + oldFormat.removeEventListener(Event.CHANGE, changeHandler); } this._fontStylesSet.setFormatForState(state, format); if(format !== null) diff --git a/source/feathers/controls/TextArea.as b/source/feathers/controls/TextArea.as index 346392de0..a9800e105 100644 --- a/source/feathers/controls/TextArea.as +++ b/source/feathers/controls/TextArea.as @@ -1695,9 +1695,10 @@ package feathers.controls { processStyleRestriction(key); } - if(format !== null) + var oldFormat:TextFormat = this._fontStylesSet.getFormatForState(state); + if(oldFormat !== null) { - format.removeEventListener(Event.CHANGE, changeHandler); + oldFormat.removeEventListener(Event.CHANGE, changeHandler); } this._fontStylesSet.setFormatForState(state, format); if(format !== null) diff --git a/source/feathers/controls/TextInput.as b/source/feathers/controls/TextInput.as index deb38defa..0bfd0ebe2 100644 --- a/source/feathers/controls/TextInput.as +++ b/source/feathers/controls/TextInput.as @@ -2597,9 +2597,10 @@ package feathers.controls { processStyleRestriction(key); } - if(format !== null) + var oldFormat:TextFormat = this._fontStylesSet.getFormatForState(state); + if(oldFormat !== null) { - format.removeEventListener(Event.CHANGE, changeHandler); + oldFormat.removeEventListener(Event.CHANGE, changeHandler); } this._fontStylesSet.setFormatForState(state, format); if(format !== null) @@ -2656,9 +2657,10 @@ package feathers.controls { processStyleRestriction(key); } - if(format !== null) + var oldFormat:TextFormat = this._promptFontStylesSet.getFormatForState(state); + if(oldFormat !== null) { - format.removeEventListener(Event.CHANGE, changeHandler); + oldFormat.removeEventListener(Event.CHANGE, changeHandler); } this._promptFontStylesSet.setFormatForState(state, format); if(format !== null) diff --git a/source/feathers/controls/ToggleSwitch.as b/source/feathers/controls/ToggleSwitch.as index b23e4d564..06ec74d99 100644 --- a/source/feathers/controls/ToggleSwitch.as +++ b/source/feathers/controls/ToggleSwitch.as @@ -2469,9 +2469,10 @@ package feathers.controls { processStyleRestriction(key); } - if(format !== null) + var oldValue:TextFormat = this._onLabelFontStylesSet.getFormatForState(state); + if (oldValue !== null) { - format.removeEventListener(Event.CHANGE, changeHandler); + oldValue.removeEventListener(Event.CHANGE, changeHandler); } this._onLabelFontStylesSet.setFormatForState(state, format); if(format !== null) @@ -2528,9 +2529,10 @@ package feathers.controls { processStyleRestriction(key); } - if(format !== null) + var oldValue:TextFormat = this._offLabelFontStylesSet.getFormatForState(state); + if(oldValue !== null) { - format.removeEventListener(Event.CHANGE, changeHandler); + oldValue.removeEventListener(Event.CHANGE, changeHandler); } this._offLabelFontStylesSet.setFormatForState(state, format); if(format !== null)