From d4738934f8c364605996ae3bbf49e42b5b7cd63b Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sat, 1 Apr 2023 14:22:17 +0200 Subject: [PATCH] Fix Resource Watcher crash --- .../ResourceWatcher/ResourceWatcher.Record.cs | 50 ++++++++++--------- .../UI/ResourceWatcher/ResourceWatcher.cs | 2 +- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/Penumbra/UI/ResourceWatcher/ResourceWatcher.Record.cs b/Penumbra/UI/ResourceWatcher/ResourceWatcher.Record.cs index 9b54cb85..e438be27 100644 --- a/Penumbra/UI/ResourceWatcher/ResourceWatcher.Record.cs +++ b/Penumbra/UI/ResourceWatcher/ResourceWatcher.Record.cs @@ -95,35 +95,37 @@ internal unsafe struct Record var path = handle->FileName().Clone(); return new Record { - Time = DateTime.UtcNow, - Path = path, - OriginalPath = ByteString.Empty, - Collection = null, - Handle = handle, - ResourceType = handle->FileType.ToFlag(), - Category = handle->Category.ToFlag(), - RefCount = handle->RefCount, - RecordType = RecordType.Destruction, - Synchronously = OptionalBool.Null, - ReturnValue = OptionalBool.Null, - CustomLoad = OptionalBool.Null, + Time = DateTime.UtcNow, + Path = path, + OriginalPath = ByteString.Empty, + Collection = null, + Handle = handle, + ResourceType = handle->FileType.ToFlag(), + Category = handle->Category.ToFlag(), + RefCount = handle->RefCount, + RecordType = RecordType.Destruction, + Synchronously = OptionalBool.Null, + ReturnValue = OptionalBool.Null, + CustomLoad = OptionalBool.Null, + AssociatedGameObject = string.Empty, }; } public static Record CreateFileLoad(ByteString path, ResourceHandle* handle, bool ret, bool custom) => new() { - Time = DateTime.UtcNow, - Path = path.IsOwned ? path : path.Clone(), - OriginalPath = ByteString.Empty, - Collection = null, - Handle = handle, - ResourceType = handle->FileType.ToFlag(), - Category = handle->Category.ToFlag(), - RefCount = handle->RefCount, - RecordType = RecordType.FileLoad, - Synchronously = OptionalBool.Null, - ReturnValue = ret, - CustomLoad = custom, + Time = DateTime.UtcNow, + Path = path.IsOwned ? path : path.Clone(), + OriginalPath = ByteString.Empty, + Collection = null, + Handle = handle, + ResourceType = handle->FileType.ToFlag(), + Category = handle->Category.ToFlag(), + RefCount = handle->RefCount, + RecordType = RecordType.FileLoad, + Synchronously = OptionalBool.Null, + ReturnValue = ret, + CustomLoad = custom, + AssociatedGameObject = string.Empty, }; } diff --git a/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs b/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs index 8b054033..ec0274b6 100644 --- a/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs +++ b/Penumbra/UI/ResourceWatcher/ResourceWatcher.cs @@ -20,7 +20,7 @@ using Penumbra.UI.Classes; namespace Penumbra.UI; -public partial class ResourceWatcher : IDisposable, ITab +public class ResourceWatcher : IDisposable, ITab { public const int DefaultMaxEntries = 1024; public const RecordType AllRecords = RecordType.Request | RecordType.ResourceLoad | RecordType.FileLoad | RecordType.Destruction;