Improve safety of ongoing operation tracker

Finishing an operation started via
`OngoingOperationTracker.BeginOperation()` was risky in cases where the
operation ended at a callback on another thread (which, in the case of
multiplayer, is *most* cases). In particular, if any consumer registered
a callback that mutates transforms when the operation ends, it would
result in crashes after the framework-side safety checks.

Rework `OngoingOperationTracker` into an always-present component
residing in the drawable hierarchy, and ensure that the
`operationInProgress` bindable is always updated on the update thread.
This way consumers don't have to add local schedules in multiple places.
This commit is contained in:
Bartłomiej Dach
2021-01-09 21:38:20 +01:00
parent c8d83a9fb3
commit 8c3955d341
5 changed files with 19 additions and 11 deletions

View File

@ -54,7 +54,7 @@ namespace osu.Game.Screens.OnlinePlay
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>(new FilterCriteria());
[Cached]
private readonly OngoingOperationTracker ongoingOperationTracker = new OngoingOperationTracker();
private OngoingOperationTracker ongoingOperationTracker { get; set; }
[Resolved(CanBeNull = true)]
private MusicController music { get; set; }
@ -144,7 +144,8 @@ namespace osu.Game.Screens.OnlinePlay
};
button.Action = () => OpenNewRoom();
}),
RoomManager = CreateRoomManager()
RoomManager = CreateRoomManager(),
ongoingOperationTracker = new OngoingOperationTracker()
}
};