Skip to content

Commit

Permalink
Fix a few more wrong listener removals on fontStyles change (references
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Feb 24, 2023
1 parent 33ee45c commit 48166bf
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
5 changes: 3 additions & 2 deletions source/feathers/controls/Button.as
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions source/feathers/controls/TextArea.as
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1754,9 +1755,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)
Expand Down
10 changes: 6 additions & 4 deletions source/feathers/controls/TextInput.as
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions source/feathers/controls/ToggleSwitch.as
Original file line number Diff line number Diff line change
Expand Up @@ -2469,9 +2469,10 @@ package feathers.controls
{
processStyleRestriction(key);
}
if(format !== null)
var oldFormat:TextFormat = this._onLabelFontStylesSet.getFormatForState(state);
if(oldFormat !== null)
{
format.removeEventListener(Event.CHANGE, changeHandler);
oldFormat.removeEventListener(Event.CHANGE, changeHandler);
}
this._onLabelFontStylesSet.setFormatForState(state, format);
if(format !== null)
Expand Down Expand Up @@ -2528,9 +2529,10 @@ package feathers.controls
{
processStyleRestriction(key);
}
if(format !== null)
var oldFormat:TextFormat = this._offLabelFontStylesSet.getFormatForState(state);
if(oldFormat !== null)
{
format.removeEventListener(Event.CHANGE, changeHandler);
oldFormat.removeEventListener(Event.CHANGE, changeHandler);
}
this._offLabelFontStylesSet.setFormatForState(state, format);
if(format !== null)
Expand Down

0 comments on commit 48166bf

Please sign in to comment.