mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:47:29 +08:00
Fix disposal issues in ChatOverlay testcase
This commit is contained in:
parent
ce92c8d2eb
commit
119f81b86e
@ -339,13 +339,26 @@ namespace osu.Game.Overlays
|
||||
this.channelManager = channelManager;
|
||||
channelManager.CurrentChannel.ValueChanged += currentChannelChanged;
|
||||
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
||||
channelManager.AvailableChannels.CollectionChanged += (sender, args) => channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
||||
|
||||
//for the case that channelmanager was faster at fetching the channels than our attachment to CollectionChanged.
|
||||
channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
joinedChannelsChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, channelManager.JoinedChannels));
|
||||
}
|
||||
|
||||
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
channelSelection.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
channelManager.CurrentChannel.ValueChanged -= currentChannelChanged;
|
||||
channelManager.JoinedChannels.CollectionChanged -= joinedChannelsChanged;
|
||||
channelManager.AvailableChannels.CollectionChanged -= availableChannelsChanged;
|
||||
}
|
||||
|
||||
private void postMessage(TextBox textbox, bool newText)
|
||||
{
|
||||
var text = textbox.Text.Trim();
|
||||
|
Loading…
Reference in New Issue
Block a user