Correct disposal.

This commit is contained in:
Huo Yaoyuan
2019-11-12 21:39:38 +08:00
parent de732c6c24
commit e01a50e4b3

View File

@ -16,13 +16,13 @@ namespace osu.Game.Utils
/// </summary> /// </summary>
public class SentryLogger : IDisposable public class SentryLogger : IDisposable
{ {
private readonly List<Task> tasks = new List<Task>(); private IDisposable sentry;
public SentryLogger(OsuGame game) public SentryLogger(OsuGame game)
{ {
if (!game.IsDeployedBuild) return; if (!game.IsDeployedBuild) return;
SentrySdk.Init(new SentryOptions sentry = SentrySdk.Init(new SentryOptions
{ {
Dsn = new Dsn("https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255"), Dsn = new Dsn("https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255"),
Release = game.Version Release = game.Version
@ -81,16 +81,6 @@ namespace osu.Game.Utils
return true; return true;
} }
private void queuePendingTask(Task<string> task)
{
lock (tasks) tasks.Add(task);
task.ContinueWith(_ =>
{
lock (tasks)
tasks.Remove(task);
});
}
#region Disposal #region Disposal
~SentryLogger() ~SentryLogger()
@ -112,7 +102,8 @@ namespace osu.Game.Utils
return; return;
isDisposed = true; isDisposed = true;
lock (tasks) Task.WaitAll(tasks.ToArray(), 5000); sentry.Dispose();
sentry = null;
} }
#endregion #endregion