Skip to content

Commit 90278fc

Browse files
committed
fix bug
1 parent e251daa commit 90278fc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎Torch.Server/Views/LogEventViewer.xaml.cs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public LogEventViewer()
6060
DataContext = new LogViewModel();
6161

6262
NlogCustomTarget.LogEventReceived += LogEvent;
63-
63+
TorchServer.Instance.SessionUnloading += Unloading;
64+
6465

6566
//on loaded event
6667
Loaded += (sender, args) =>
@@ -71,6 +72,11 @@ public LogEventViewer()
7172
};
7273
}
7374

75+
private void Unloading()
76+
{
77+
NlogCustomTarget.LogEventReceived -= LogEvent;
78+
}
79+
7480
private void LogEvent(LogEventInfo obj)
7581
{
7682
// Use Dispatcher.Invoke to ensure that the following code block is executed on the UI thread.
@@ -95,8 +101,6 @@ private void LogEvent(LogEventInfo obj)
95101
}
96102
});
97103
}
98-
99-
100104
private void LevelFilterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
101105
{
102106
ApplyFilters();

0 commit comments

Comments
 (0)