mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:02:54 +08:00
Fix some incorrectly invoked async
calls
This commit is contained in:
parent
7b4317be9a
commit
f2d9d78455
@ -116,7 +116,7 @@ namespace osu.Desktop.Updater
|
||||
if (scheduleRecheck)
|
||||
{
|
||||
// check again in 30 minutes.
|
||||
Scheduler.AddDelayed(async () => await checkForUpdateAsync().ConfigureAwait(false), 60000 * 30);
|
||||
Scheduler.AddDelayed(() => Task.Run(async () => await checkForUpdateAsync().ConfigureAwait(false)), 60000 * 30);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ namespace osu.Desktop.Updater
|
||||
Activated = () =>
|
||||
{
|
||||
updateManager.PrepareUpdateAsync()
|
||||
.ContinueWith(_ => updateManager.Schedule(() => game.GracefullyExit()));
|
||||
.ContinueWith(_ => updateManager.Schedule(() => game?.GracefullyExit()));
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -65,7 +66,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(200, 50),
|
||||
OnReadyClick = async () =>
|
||||
OnReadyClick = () => Task.Run(async () =>
|
||||
{
|
||||
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
||||
|
||||
@ -77,7 +78,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
await Client.ToggleReady();
|
||||
readyClickOperation.Dispose();
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -69,19 +70,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(200, 50),
|
||||
OnSpectateClick = async () =>
|
||||
OnSpectateClick = () => Task.Run(async () =>
|
||||
{
|
||||
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
||||
await Client.ToggleSpectate();
|
||||
readyClickOperation.Dispose();
|
||||
}
|
||||
})
|
||||
},
|
||||
readyButton = new MultiplayerReadyButton
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(200, 50),
|
||||
OnReadyClick = async () =>
|
||||
OnReadyClick = () => Task.Run(async () =>
|
||||
{
|
||||
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
||||
|
||||
@ -93,7 +94,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
await Client.ToggleReady();
|
||||
readyClickOperation.Dispose();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -491,6 +491,10 @@ namespace osu.Game
|
||||
public override Task Import(params ImportTask[] imports)
|
||||
{
|
||||
// encapsulate task as we don't want to begin the import process until in a ready state.
|
||||
|
||||
// ReSharper disable once AsyncVoidLambda
|
||||
// TODO: This is bad because `new Task` doesn't have a Func<Task?> override.
|
||||
// Only used for android imports and a bit of a mess. Probably needs rethinking overall.
|
||||
var importTask = new Task(async () => await base.Import(imports).ConfigureAwait(false));
|
||||
|
||||
waitForReady(() => this, _ => importTask.Start());
|
||||
|
Loading…
Reference in New Issue
Block a user