This commit is contained in:
Luke Pulverenti
2017-09-05 15:49:02 -04:00
parent 3b318a3add
commit 49b799adbe
69 changed files with 207 additions and 187 deletions

View File

@@ -491,6 +491,7 @@ namespace Emby.Server.Implementations.Activity
//_logManager.LoggerLoaded -= _logManager_LoggerLoaded;
_appHost.ApplicationUpdated -= _appHost_ApplicationUpdated;
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -828,7 +828,7 @@ namespace Emby.Server.Implementations
RegisterSingleInstance(MemoryStreamFactory);
RegisterSingleInstance(SystemEvents);
RegisterSingleInstance(LogManager);
RegisterSingleInstance(LogManager, false);
RegisterSingleInstance(Logger);
RegisterSingleInstance(EnvironmentInfo);
@@ -2341,6 +2341,7 @@ namespace Emby.Server.Implementations
_disposed = true;
Dispose(true);
GC.SuppressFinalize(this);
}
}
@@ -2354,6 +2355,7 @@ namespace Emby.Server.Implementations
{
var type = GetType();
LogManager.AddConsoleOutput();
Logger.Info("Disposing " + type.Name);
var parts = DisposableParts.Distinct().Where(i => i.GetType() != type).ToList();

View File

@@ -1624,6 +1624,7 @@ namespace Emby.Server.Implementations.Channels
public void Dispose()
{
GC.SuppressFinalize(this);
}
}
}

View File

@@ -77,6 +77,7 @@ namespace Emby.Server.Implementations.Data
{
Close();
}
GC.SuppressFinalize(this);
}
}
}

View File

@@ -104,6 +104,7 @@ namespace Emby.Server.Implementations.Diagnostics
public void Dispose()
{
_process.Dispose();
GC.SuppressFinalize(this);
}
}
}

View File

@@ -112,6 +112,7 @@ namespace Emby.Server.Implementations.EntryPoints
_appHost.HasPendingRestartChanged -= _appHost_HasPendingRestartChanged;
DisposeTimer();
GC.SuppressFinalize(this);
}
private void DisposeTimer()

View File

@@ -294,6 +294,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
_disposed = true;
DisposeNat();
GC.SuppressFinalize(this);
}
private void DisposeNat()

View File

@@ -60,6 +60,7 @@ namespace Emby.Server.Implementations.EntryPoints
_timer.Dispose();
_timer = null;
}
GC.SuppressFinalize(this);
}
}
}

View File

@@ -426,6 +426,7 @@ namespace Emby.Server.Implementations.EntryPoints
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -68,6 +68,7 @@ namespace Emby.Server.Implementations.EntryPoints
_timer.Dispose();
_timer = null;
}
GC.SuppressFinalize(this);
}
}
}

View File

@@ -72,6 +72,7 @@ namespace Emby.Server.Implementations.EntryPoints
_liveTvManager.SeriesTimerCancelled -= _liveTvManager_SeriesTimerCancelled;
_liveTvManager.TimerCreated -= _liveTvManager_TimerCreated;
_liveTvManager.SeriesTimerCreated -= _liveTvManager_SeriesTimerCreated;
GC.SuppressFinalize(this);
}
}
}

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Library;
using System;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using System.Threading;
@@ -36,6 +37,7 @@ namespace Emby.Server.Implementations.EntryPoints
/// </summary>
public void Dispose()
{
GC.SuppressFinalize(this);
}
}
}

View File

@@ -174,6 +174,7 @@ namespace Emby.Server.Implementations.EntryPoints
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -1,4 +1,5 @@
using Emby.Server.Implementations.Browser;
using System;
using Emby.Server.Implementations.Browser;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Logging;
@@ -54,6 +55,7 @@ namespace Emby.Server.Implementations.EntryPoints
/// </summary>
public void Dispose()
{
GC.SuppressFinalize(this);
}
}
}

View File

@@ -43,6 +43,7 @@ namespace Emby.Server.Implementations.EntryPoints
public void Dispose()
{
_systemEvents.SystemShutdown -= _systemEvents_SystemShutdown;
GC.SuppressFinalize(this);
}
}
}

View File

@@ -65,6 +65,7 @@ namespace Emby.Server.Implementations.EntryPoints
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -130,6 +130,7 @@ namespace Emby.Server.Implementations.EntryPoints
public void Dispose()
{
_sessionManager.SessionStarted -= _sessionManager_SessionStarted;
GC.SuppressFinalize(this);
}
}
}

View File

@@ -160,6 +160,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
_userDataManager.UserDataSaved -= _userDataManager_UserDataSaved;
GC.SuppressFinalize(this);
}
}
}

View File

@@ -822,27 +822,6 @@ namespace Emby.Server.Implementations.HttpClientManager
return url;
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool dispose)
{
if (dispose)
{
_httpClients.Clear();
}
}
/// <summary>
/// Throws the cancellation exception.
/// </summary>

View File

@@ -123,6 +123,7 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -238,6 +238,7 @@ namespace Emby.Server.Implementations.IO
{
_disposed = true;
DisposeTimer();
GC.SuppressFinalize(this);
}
}
}

View File

@@ -70,6 +70,7 @@ namespace Emby.Server.Implementations.IO
{
mounter.Dispose();
}
GC.SuppressFinalize(this);
}
}
}

View File

@@ -649,6 +649,7 @@ namespace Emby.Server.Implementations.IO
public void Dispose()
{
GC.SuppressFinalize(this);
}
}
}

View File

@@ -524,6 +524,7 @@ namespace Emby.Server.Implementations.Library
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private readonly object _disposeLock = new object();

View File

@@ -2630,6 +2630,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
pair.Value.CancellationTokenSource.Cancel();
}
GC.SuppressFinalize(this);
}
public List<VirtualFolderInfo> GetRecordingFolders()

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Plugins;
using System;
using MediaBrowser.Controller.Plugins;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
@@ -11,6 +12,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public void Dispose()
{
GC.SuppressFinalize(this);
}
}
}

View File

@@ -2779,6 +2779,7 @@ namespace Emby.Server.Implementations.LiveTv
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private bool _isDisposed = false;

View File

@@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
SupportsTranscoding = true,
IsInfiniteStream = true,
IgnoreDts = true,
//SupportsProbing = false,
SupportsProbing = false,
//AnalyzeDurationMs = 2000000
//IgnoreIndex = true,
//ReadAtNativeFramerate = true

View File

@@ -99,6 +99,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var task = StopStreaming();
Task.WaitAll(task);
GC.SuppressFinalize(this);
}
public async Task<bool> CheckTunerAvailability(IpAddressInfo remoteIp, int tuner, CancellationToken cancellationToken)

View File

@@ -107,6 +107,7 @@ namespace Emby.Server.Implementations.Logging
}
_fileLogger = null;
GC.SuppressFinalize(this);
}
}
@@ -130,13 +131,18 @@ namespace Emby.Server.Implementations.Logging
private void LogInternal()
{
while (!_cancellationTokenSource.IsCancellationRequested)
while (!_cancellationTokenSource.IsCancellationRequested && !_disposed)
{
try
{
foreach (var message in _queue.GetConsumingEnumerable())
{
var bytes = Encoding.UTF8.GetBytes(message + Environment.NewLine);
if (_disposed)
{
return;
}
_fileStream.Write(bytes, 0, bytes.Length);
_fileStream.Flush(true);
@@ -166,17 +172,18 @@ namespace Emby.Server.Implementations.Logging
return;
}
_fileStream.Flush();
_fileStream.Flush(true);
}
public void Dispose()
{
_cancellationTokenSource.Cancel();
_disposed = true;
Flush();
_fileStream.Flush();
_disposed = true;
_fileStream.Dispose();
GC.SuppressFinalize(this);
}
}

View File

@@ -92,6 +92,7 @@ namespace Emby.Server.Implementations.Net
public void Dispose()
{
Socket.Dispose();
GC.SuppressFinalize(this);
}
}
}

View File

@@ -271,6 +271,7 @@ namespace Emby.Server.Implementations.News
_timer.Dispose();
_timer = null;
}
GC.SuppressFinalize(this);
}
}
}

View File

@@ -551,6 +551,7 @@ namespace Emby.Server.Implementations.Notifications
_deviceManager.CameraImageUploaded -= _deviceManager_CameraImageUploaded;
_userManager.UserLockedOut -= _userManager_UserLockedOut;
GC.SuppressFinalize(this);
}
private void DisposeLibraryUpdateTimer()

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Net;
using System;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Controller.Plugins;
using System.Linq;
@@ -49,6 +50,7 @@ namespace Emby.Server.Implementations.Notifications
public void Dispose()
{
_notificationsRepo.NotificationAdded -= _notificationsRepo_NotificationAdded;
GC.SuppressFinalize(this);
}
}
}

View File

@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace Emby.Server.Implementations.Session
{
public class HttpSessionController : ISessionController, IDisposable
public class HttpSessionController : ISessionController
{
private readonly IHttpClient _httpClient;
private readonly IJsonSerializer _json;
@@ -195,9 +195,5 @@ namespace Emby.Server.Implementations.Session
return "?" + args;
}
public void Dispose()
{
}
}
}

View File

@@ -102,6 +102,7 @@ namespace Emby.Server.Implementations.Session
public void Dispose()
{
_serverManager.WebSocketConnected -= _serverManager_WebSocketConnected;
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -283,6 +283,7 @@ namespace Emby.Server.Implementations.Session
{
socket.Closed -= connection_Closed;
}
GC.SuppressFinalize(this);
}
}
}

View File

@@ -217,6 +217,7 @@ namespace Emby.Server.Implementations.TV
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>

View File

@@ -31,6 +31,7 @@ namespace Emby.Server.Implementations.Threading
public void Dispose()
{
_timer.Dispose();
GC.SuppressFinalize(this);
}
}
}

View File

@@ -722,6 +722,7 @@ namespace Emby.Server.Implementations.Updates
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}