File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
SIL.Windows.Forms/Widgets Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616
1717## [ Unreleased]
1818
19+ ### Fixed
20+ - [ SIL.Windows.Forms] Prevent BetterLabel from responding to OnTextChanged when it has been disposed.
21+
1922### Changed
2023
2124- [ SIL.Windows.Forms] BREAKING CHANGE: Upgraded to L10nSharp v9. Any clients which also use L10nSharp must also upgrade to v9.
Original file line number Diff line number Diff line change @@ -134,9 +134,11 @@ protected override void OnParentChanged(EventArgs e)
134134
135135 protected override void OnTextChanged ( EventArgs e )
136136 {
137+ if ( IsDisposed )
138+ return ; // This has happened in Bloom (BL-15424) and caused a crash.
137139 //this is apparently dangerous to do in the constructor
138140 //Font = new Font(SystemFonts.MessageBoxFont.FontFamily, Font.Size, Font.Style);
139- if ( Font == SystemFonts . DefaultFont )
141+ if ( Font == SystemFonts . DefaultFont )
140142 Font = SystemFonts . MessageBoxFont ; //sets the default, which can then be customized in the designer
141143
142144 DetermineHeight ( ) ;
@@ -145,6 +147,8 @@ protected override void OnTextChanged(EventArgs e)
145147
146148 private void DetermineHeight ( )
147149 {
150+ if ( IsDisposed )
151+ return ; // This has happened in Bloom (BL-15424) and caused a crash.
148152 using ( var g = this . CreateGraphics ( ) )
149153 {
150154 // Use this rather than MeasureString, which uses the obsolete GDI+ and can crash on some
You can’t perform that action at this time.
0 commit comments