1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-11 10:12:58 +08:00

Make ProgressNotification's status and progress thread-safe

Quite regularly a task will hold a reference to a progress notification and udpate it as progress is made. Therefore these operations should be thread-safe.
This commit is contained in:
Dean Herbert 2017-10-18 10:07:20 +09:00
parent 120d3fbbec
commit 518e5a2245

View File

@ -25,10 +25,7 @@ namespace osu.Game.Overlays.Notifications
public float Progress public float Progress
{ {
get { return progressBar.Progress; } get { return progressBar.Progress; }
set set { Schedule(() => progressBar.Progress = value); }
{
progressBar.Progress = value;
}
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -43,6 +40,8 @@ namespace osu.Game.Overlays.Notifications
{ {
get { return state; } get { return state; }
set set
{
Schedule(() =>
{ {
bool stateChanged = state != value; bool stateChanged = state != value;
state = value; state = value;
@ -79,6 +78,7 @@ namespace osu.Game.Overlays.Notifications
break; break;
} }
} }
});
} }
} }