mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12: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 class UpdateProgressNotification : ProgressNotification
|
||||||
{
|
{
|
||||||
|
private OsuGame game;
|
||||||
|
|
||||||
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification()
|
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification()
|
||||||
{
|
{
|
||||||
Text = @"Update ready to install. Click to restart!",
|
Text = @"Update ready to install. Click to restart!",
|
||||||
Activated = () =>
|
Activated = () =>
|
||||||
{
|
{
|
||||||
UpdateManager.RestartApp();
|
UpdateManager.RestartAppWhenExited();
|
||||||
|
game.GracefullyExit();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, OsuGame game)
|
||||||
{
|
{
|
||||||
|
this.game = game;
|
||||||
|
|
||||||
IconContent.Add(new Drawable[]
|
IconContent.Add(new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
|
@ -307,6 +307,18 @@ namespace osu.Game
|
|||||||
return base.OnExiting();
|
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()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
Loading…
Reference in New Issue
Block a user