Skip to content

Commit 00e56ce

Browse files
committed
fix: System.NullReferenceException raised after popup stop (success or not) running
Signed-off-by: leo <longshuang@msn.cn>
1 parent 22d4f26 commit 00e56ce

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/Views/PopupRunningStatus.axaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
<TextBlock Margin="6,0,0,0" FontSize="14" FontWeight="Bold" Text="{DynamicResource Text.Running}"/>
1616
</StackPanel>
1717

18-
<TextBlock x:Name="TxtDesc"
19-
HorizontalAlignment="Stretch"
18+
<TextBlock HorizontalAlignment="Stretch"
2019
TextWrapping="Wrap"
2120
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
2221
FontStyle="Italic"

src/Views/PopupRunningStatus.axaml.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,9 @@ public PopupRunningStatus()
2121
InitializeComponent();
2222
}
2323

24-
protected override void OnLoaded(RoutedEventArgs e)
25-
{
26-
base.OnLoaded(e);
27-
28-
if (IsVisible)
29-
StartAnim();
30-
}
31-
3224
protected override void OnUnloaded(RoutedEventArgs e)
3325
{
34-
StopAnim();
26+
_isUnloading = true;
3527
base.OnUnloaded(e);
3628
}
3729

@@ -41,7 +33,7 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang
4133

4234
if (change.Property == IsVisibleProperty)
4335
{
44-
if (IsVisible)
36+
if (IsVisible && !_isUnloading)
4537
StartAnim();
4638
else
4739
StopAnim();
@@ -61,5 +53,7 @@ private void StopAnim()
6153
Icon.Content = null;
6254
ProgressBar.IsIndeterminate = false;
6355
}
56+
57+
private bool _isUnloading = false;
6458
}
6559
}

0 commit comments

Comments
 (0)