Возможный фикс утечки памяти в меню аплинка с музыкой (#3804)
This commit is contained in:
parent
8725604e5d
commit
91b97dbd6b
3 changed files with 6 additions and 3 deletions
|
|
@ -61,7 +61,7 @@ public sealed class TapePlayerBoundUserInterface : BoundUserInterface
|
|||
if (_entityManager.TryGetComponent<MusicTapeComponent>(tapePlayer.InsertedTape, out var musicTapeComponent))
|
||||
{
|
||||
var audio = EntMan.System<AudioSystem>();
|
||||
var length = audio.GetAudioLength(audio.GetSound(musicTapeComponent.Sound));
|
||||
var length = audio.GetAudioLength(audio.ResolveSound(musicTapeComponent.Sound));
|
||||
_menu.SetSelectedSong(musicTapeComponent.SongName, (float) length.TotalSeconds);
|
||||
}
|
||||
else
|
||||
|
|
@ -104,7 +104,7 @@ public sealed class TapePlayerBoundUserInterface : BoundUserInterface
|
|||
return;
|
||||
|
||||
_menu.OnClose -= Close;
|
||||
_menu.Dispose();
|
||||
_menu.Orphan();
|
||||
_menu = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ namespace Content.Client._Sunrise.TapePlayer
|
|||
|
||||
private void OnTapePlayerAfterState(Entity<TapePlayerComponent> ent, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (IsClientSide(ent))
|
||||
return;
|
||||
|
||||
if (!_uiSystem.TryGetOpenUi<TapePlayerBoundUserInterface>(ent.Owner, TapePlayerUiKey.Key, out var bui))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Content.Shared._Sunrise.TapePlayer
|
|||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class MusicTapeComponent : Component
|
||||
{
|
||||
[DataField(customTypeSerializer: typeof(SoundSpecifierTypeSerializer), required: true)]
|
||||
[DataField(required: true)]
|
||||
public SoundSpecifier Sound;
|
||||
|
||||
[DataField]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue