From b8a01da5d1763c60492e96bde97f204c8d0ed97c Mon Sep 17 00:00:00 2001 From: Simca Date: Fri, 11 Mar 2022 20:14:40 -0500 Subject: [PATCH] Don't unintentionally close stdin on non-Windows. The SafeHandle that is used to implement IDisposable was copied from the .NET docs and isn't needed. It leads to unintentionally closing stdin (file descriptor zero) on non-Windows platforms, which causes to hard to diagnose issues in other code. --- Data/Tracker/BaseTracker.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Data/Tracker/BaseTracker.cs b/Data/Tracker/BaseTracker.cs index e01ea13..14d2b83 100644 --- a/Data/Tracker/BaseTracker.cs +++ b/Data/Tracker/BaseTracker.cs @@ -8,7 +8,6 @@ using Newtonsoft.Json; using System.IO; using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; using MongoDB.Bson.Serialization.Options; using MongoDB.Bson.Serialization.Attributes; using System.ServiceModel.Syndication; @@ -24,7 +23,6 @@ public abstract class BaseTracker : IDisposable public enum TrackerType { TikTok, Twitch, TwitchGroup, TwitchClip, Twitter, Youtube, YoutubeLive, Reddit, Steam, Osu, Overwatch, OSRS, JSON, HTML, RSS }; public static List CapSensitive = new List{TrackerType.HTML, TrackerType.Reddit, TrackerType.JSON, TrackerType.Overwatch, TrackerType.RSS, TrackerType.Youtube, TrackerType.YoutubeLive}; private bool disposed = false; - private SafeHandle handle = new SafeFileHandle(IntPtr.Zero, true); //protected System.Threading.Timer checkForChange; public event MainEventHandler OnMajorEventFired; public event MinorEventHandler OnMinorEventFired; @@ -165,11 +163,10 @@ protected virtual void Dispose(bool disposing) if (disposed) return; - if (disposing) + /*if (disposing) { - handle.Dispose(); - //checkForChange.Dispose(); - } + checkForChange.Dispose(); + }*/ disposed = true; }