From 05fe8968d88f763621afe3042d665afaa8934331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 3 Apr 2024 11:39:12 +0200 Subject: [PATCH] Only interact with clipboard via bound copy --- osu.Game/Overlays/SkinEditor/SkinEditor.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs index ac9649bcba..619eac8f4a 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs @@ -66,9 +66,6 @@ namespace osu.Game.Overlays.SkinEditor [Resolved] private RealmAccess realm { get; set; } = null!; - [Resolved] - private EditorClipboard clipboard { get; set; } = null!; - [Resolved] private SkinEditorOverlay? skinEditorOverlay { get; set; } @@ -114,7 +111,7 @@ namespace osu.Game.Overlays.SkinEditor } [BackgroundDependencyLoader] - private void load() + private void load(EditorClipboard clipboard) { RelativeSizeAxes = Axes.Both; @@ -225,6 +222,8 @@ namespace osu.Game.Overlays.SkinEditor } } }; + + clipboardContent = clipboard.Content.GetBoundCopy(); } protected override void LoadComplete() @@ -244,7 +243,6 @@ namespace osu.Game.Overlays.SkinEditor canCopy.Value = canCut.Value = SelectedComponents.Any(); }, true); - clipboardContent = clipboard.Content.GetBoundCopy(); clipboardContent.BindValueChanged(content => canPaste.Value = !string.IsNullOrEmpty(content.NewValue), true); Show(); @@ -497,7 +495,7 @@ namespace osu.Game.Overlays.SkinEditor protected void Copy() { - clipboard.Content.Value = JsonConvert.SerializeObject(SelectedComponents.Cast().Select(s => s.CreateSerialisedInfo()).ToArray()); + clipboardContent.Value = JsonConvert.SerializeObject(SelectedComponents.Cast().Select(s => s.CreateSerialisedInfo()).ToArray()); } protected void Clone() @@ -517,7 +515,7 @@ namespace osu.Game.Overlays.SkinEditor changeHandler?.BeginChange(); - var drawableInfo = JsonConvert.DeserializeObject(clipboard.Content.Value); + var drawableInfo = JsonConvert.DeserializeObject(clipboardContent.Value); if (drawableInfo == null) return;