From 14d9f1d8bbc817ff2417372cffc0bee7b8eefdba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Dec 2018 18:13:10 +0900 Subject: [PATCH 1/2] Fix hard crash due to out-of-order chat sequencing --- osu.Game/Overlays/Chat/DrawableChannel.cs | 11 +++++------ osu.Game/osu.Game.csproj | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index ce5d961282..2418eda2b6 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -48,10 +48,6 @@ namespace osu.Game.Overlays.Chat }, } }; - - Channel.NewMessagesArrived += newMessagesArrived; - Channel.MessageRemoved += messageRemoved; - Channel.PendingMessageResolved += pendingMessageResolved; } protected override void LoadComplete() @@ -59,6 +55,11 @@ namespace osu.Game.Overlays.Chat base.LoadComplete(); newMessagesArrived(Channel.Messages); + + Channel.NewMessagesArrived += newMessagesArrived; + Channel.MessageRemoved += messageRemoved; + Channel.PendingMessageResolved += pendingMessageResolved; + scrollToEnd(); } @@ -78,8 +79,6 @@ namespace osu.Game.Overlays.Chat flow.AddRange(displayMessages.Select(m => new ChatLine(m))); - if (!IsLoaded) return; - if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m is LocalMessage)) scrollToEnd(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a1578b6eb8..85eabb0350 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From bc9290bfcbb3e1fcb49fe5f1b7feb6327462fdcf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Dec 2018 18:43:39 +0900 Subject: [PATCH 2/2] Schedule cross thread access in test case --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 87235add37..d87a8d0056 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -98,8 +98,11 @@ namespace osu.Game.Tests.Visual [SetUp] public virtual void SetUp() { - manager?.Delete(manager.GetAllUsableBeatmapSets()); - Child = songSelect = new TestSongSelect(); + Schedule(() => + { + manager?.Delete(manager.GetAllUsableBeatmapSets()); + Child = songSelect = new TestSongSelect(); + }); } [Test]