From ace51b396d24c5c8c8e6dace1ace3163146078a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Sun, 9 Jun 2024 00:29:15 +0200 Subject: [PATCH] Fixed crash when assets gets queued for reloading twice --- GlitchyEditor/src/EditorContentManager.bf | 6 +++--- GlitchyEngine/src/Content/AssetIdentifier.bf | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/GlitchyEditor/src/EditorContentManager.bf b/GlitchyEditor/src/EditorContentManager.bf index 102122f..e405c34 100644 --- a/GlitchyEditor/src/EditorContentManager.bf +++ b/GlitchyEditor/src/EditorContentManager.bf @@ -59,8 +59,8 @@ class EditorContentManager : IContentManager public void QueueAssetReload(AssetHandle assetHandle) { - // The asset isn't loaded, so we don't need to reload. - if (!_handleToAsset.ContainsKey(assetHandle)) + // If the asset isn't loaded we don't care about reloading it. Also don't reload twice + if (!_handleToAsset.ContainsKey(assetHandle) || _reloadQueue.Contains(assetHandle)) return; _reloadQueue.Add(assetHandle); @@ -642,7 +642,7 @@ class EditorContentManager : IContentManager _handleToAsset.Add(handle, loadedAsset); _identiferToHandle.Add(loadedAsset.Identifier, handle); - SetReference!(file.[Friend]_loadedAsset, loadedAsset); + file.[Friend]_loadedAsset = loadedAsset; } return handle; diff --git a/GlitchyEngine/src/Content/AssetIdentifier.bf b/GlitchyEngine/src/Content/AssetIdentifier.bf index d343827..2dc4cf3 100644 --- a/GlitchyEngine/src/Content/AssetIdentifier.bf +++ b/GlitchyEngine/src/Content/AssetIdentifier.bf @@ -90,4 +90,9 @@ public class AssetIdentifier assetIdentifier.EnsureNullTerminator(); } + + public override void ToString(String strBuffer) + { + strBuffer.Append(FullIdentifier); + } }