Fix judgement disposals causing huge LOH pressure

This commit is contained in:
smoogipoo 2019-07-17 19:25:41 +09:00
parent 1a19cf0739
commit 9f6ff63634
2 changed files with 11 additions and 4 deletions

View File

@ -12,6 +12,7 @@
using System.Linq;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.UI
{
@ -39,7 +40,13 @@ public OsuPlayfield()
RelativeSizeAxes = Axes.Both,
Depth = 1,
},
HitObjectContainer,
// Todo: This should not exist, but currently helps to reduce LOH allocations due to unbinding skin source events on judgement disposal
// Todo: Remove when hitobjects are properly pooled
new LocalSkinOverrideContainer(null)
{
RelativeSizeAxes = Axes.Both,
Child = HitObjectContainer,
},
approachCircles = new ApproachCircleProxyContainer
{
RelativeSizeAxes = Axes.Both,

View File

@ -34,7 +34,7 @@ public LocalSkinOverrideContainer(ISkin skin)
public Drawable GetDrawableComponent(string componentName)
{
Drawable sourceDrawable;
if (beatmapSkins.Value && (sourceDrawable = skin.GetDrawableComponent(componentName)) != null)
if (beatmapSkins.Value && (sourceDrawable = skin?.GetDrawableComponent(componentName)) != null)
return sourceDrawable;
return fallbackSource?.GetDrawableComponent(componentName);
@ -43,7 +43,7 @@ public Drawable GetDrawableComponent(string componentName)
public Texture GetTexture(string componentName)
{
Texture sourceTexture;
if (beatmapSkins.Value && (sourceTexture = skin.GetTexture(componentName)) != null)
if (beatmapSkins.Value && (sourceTexture = skin?.GetTexture(componentName)) != null)
return sourceTexture;
return fallbackSource.GetTexture(componentName);
@ -52,7 +52,7 @@ public Texture GetTexture(string componentName)
public SampleChannel GetSample(string sampleName)
{
SampleChannel sourceChannel;
if (beatmapHitsounds.Value && (sourceChannel = skin.GetSample(sampleName)) != null)
if (beatmapHitsounds.Value && (sourceChannel = skin?.GetSample(sampleName)) != null)
return sourceChannel;
return fallbackSource?.GetSample(sampleName);