]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix network configurator memory leaking (#27346)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fri, 26 Apr 2024 10:36:57 +0000 (20:36 +1000)
committerGitHub <noreply@github.com>
Fri, 26 Apr 2024 10:36:57 +0000 (20:36 +1000)
* Fix network configurator memory leaking

Doesn't dispose this window.

* Fix the other part

Content.Client/NetworkConfigurator/NetworkConfiguratorBoundUserInterface.cs
Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs
Content.Shared/DeviceNetwork/Systems/SharedNetworkConfiguratorSystem.cs

index 264c297b633d4b12eef597da9f5bd0719c86980c..80c98f143b989a57fb3700ac8459e20087570b28 100644 (file)
@@ -88,6 +88,7 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
         base.Dispose(disposing);
         if (!disposing) return;
 
+        _linkMenu?.Dispose();
         _listMenu?.Dispose();
         _configurationMenu?.Dispose();
     }
index b68f8a594b84f00cfd7468505a5531ea3228f294..346012415857807d7a02ddbaffaa2be12b59f260 100644 (file)
@@ -62,7 +62,6 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
         SubscribeLocalEvent<NetworkConfiguratorComponent, NetworkConfiguratorClearLinksMessage>(OnClearLinks);
         SubscribeLocalEvent<NetworkConfiguratorComponent, NetworkConfiguratorToggleLinkMessage>(OnToggleLinks);
         SubscribeLocalEvent<NetworkConfiguratorComponent, NetworkConfiguratorButtonPressedMessage>(OnConfigButtonPressed);
-        SubscribeLocalEvent<NetworkConfiguratorComponent, ActivatableUIOpenAttemptEvent>(OnUiOpenAttempt);
 
         SubscribeLocalEvent<DeviceListComponent, ComponentRemove>(OnComponentRemoved);
     }
index 4aa9db199dc6da3e796cceca6494d932b41542e5..53928f83a98d672121799471ee80dcb868c38738 100644 (file)
@@ -1,10 +1,23 @@
 using Content.Shared.Actions;
+using Content.Shared.DeviceNetwork.Components;
+using Content.Shared.UserInterface;
 using Robust.Shared.Serialization;
 
 namespace Content.Shared.DeviceNetwork.Systems;
 
 public abstract class SharedNetworkConfiguratorSystem : EntitySystem
 {
+    public override void Initialize()
+    {
+        base.Initialize();
+        SubscribeLocalEvent<NetworkConfiguratorComponent, ActivatableUIOpenAttemptEvent>(OnUiOpenAttempt);
+    }
+
+    private void OnUiOpenAttempt(EntityUid uid, NetworkConfiguratorComponent configurator, ActivatableUIOpenAttemptEvent args)
+    {
+        if (configurator.LinkModeActive)
+            args.Cancel();
+    }
 }
 
 public sealed partial class ClearAllOverlaysEvent : InstantActionEvent