Fix asset deletion flow and async loading race conditions#72
Draft
Fix asset deletion flow and async loading race conditions#72
Conversation
…system Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve asset management system functionality
Fix asset system bugs and implement missing serialization paths
Mar 6, 2026
Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot
AI
changed the title
Fix asset system bugs and implement missing serialization paths
Fix asset deletion flow and async loading race conditions
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review and fix correctness issues in the asset deletion pipeline and async loading flow, covering a compile-error-level capture bug, a double-load race, missing cache eviction on deletion, and several null-deref hazards.
Async Loading (
AssetManager::LoadAsset)asset->status.store(FAILED)inside a lambda whose capture list was[this, uuid, archive, deps=...]—assetwas never captured. Replaced withFindAsset(uuid)via the already-capturedthis:IsLoaded(). A concurrent second call for the same UUID would fall through, re-open the file, and queue a duplicate async task. Now short-circuits for bothLOADEDandLOADING.Asset Deletion
AssetDataBase::RemoveAsset: ReplacedSKY_ASSERT(idMap.count(id))with a graceful iterator-based early return. After removing from the source database, now callsAssetManager::RemoveAsset(id)to keep the runtime cache consistent.AssetManager::RemoveAsset(uuid): Evicts theweak_ptrentry under the mutex, then broadcastsIAssetEvent::OnAssetResetto all registered listeners.Misc
AssetManager::FindAssetlazily erases expiredweak_ptrentries on lookup (markedassetsmapmutableto allow this in theconstmethod).AssetDataBase::OpenFile(both overloads) andCreateOrOpenFile—GetFileSystemBySourcePathreturns null for invalid bundle types.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.