1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

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