mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Correct disposal.
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user