mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:52:57 +08:00
Fix crash on restart after update.
Also make update process more graceful.
This commit is contained in:
parent
9732110bd9
commit
7d7bea7198
@ -189,19 +189,24 @@ namespace osu.Desktop.Overlays
|
||||
|
||||
private class UpdateProgressNotification : ProgressNotification
|
||||
{
|
||||
private OsuGame game;
|
||||
|
||||
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification()
|
||||
{
|
||||
Text = @"Update ready to install. Click to restart!",
|
||||
Activated = () =>
|
||||
{
|
||||
UpdateManager.RestartApp();
|
||||
UpdateManager.RestartAppWhenExited();
|
||||
game.GracefullyExit();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, OsuGame game)
|
||||
{
|
||||
this.game = game;
|
||||
|
||||
IconContent.Add(new Drawable[]
|
||||
{
|
||||
new Box
|
||||
|
@ -307,6 +307,18 @@ namespace osu.Game
|
||||
return base.OnExiting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use to programatically exit the game as if the user was triggering via alt-f4.
|
||||
/// Will keep persisting until an exit occurs (exit may be blocked multiple times).
|
||||
/// </summary>
|
||||
public void GracefullyExit()
|
||||
{
|
||||
if (!OnExiting())
|
||||
Exit();
|
||||
else
|
||||
Scheduler.AddDelayed(GracefullyExit, 2000);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
Loading…
Reference in New Issue
Block a user