mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixes FileSystemWatcher exception on Linux. (#1600)
This commit is contained in:
@@ -94,6 +94,21 @@ namespace Terminal.Gui {
|
||||
return valid;
|
||||
}
|
||||
|
||||
private bool _disposedValue;
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (!_disposedValue) {
|
||||
if (disposing) {
|
||||
watcher?.Dispose ();
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
}
|
||||
|
||||
// Call base class implementation.
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
void Watcher_Error (object sender, ErrorEventArgs e)
|
||||
{
|
||||
Application.MainLoop.Invoke (() => Reload ());
|
||||
|
||||
@@ -647,5 +647,16 @@ namespace Terminal.Gui.Core {
|
||||
Assert.Equal (Key.PageUp | Key.CtrlMask, Application.AlternateBackwardKey);
|
||||
Assert.Equal (Key.Q | Key.CtrlMask, Application.QuitKey);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[AutoInitShutdown]
|
||||
public void FileDialog_FileSystemWatcher ()
|
||||
{
|
||||
for (int i = 0; i < 256; i++) {
|
||||
var fd = new FileDialog ();
|
||||
fd.Ready += () => Application.RequestStop ();
|
||||
Application.Run (fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user