mirror of
https://github.com/leozide/leocad.git
synced 2026-10-26 22:10:32 +00:00
Finish piece manager synchronization and error ownership
Move sparse piece load errors and registry locking into lcPieceManager so registry access, reference bookkeeping and copied worker metadata share one owner. Release registry and error locks before resource teardown, recursive project deletion or loader cancellation; remove library lock scopes around UI source resolution and worker-drained settings changes. Add HasOtherReferences to the shared asset reference for piece and texture consumer checks, removing the library/manager consumer-query wrappers. Keep the post-release cancellation count check and existing lifetime policies. Rename the sparse error map to mPieceDataLoadErrors and document the completed manager boundary and thread/teardown contracts. Validation: warning-free macOS Qt 6.10 Debug build and all 43 offscreen lifecycle checks pass, including concurrent metadata/error reads, settings changes with pending requests and shared reference queries. Qt 5, ASan and successful GPU rendering were not tested.
This commit is contained in:
1 parent
b38a1ce0fa
commit
59225f9437
8 files changed
+191
-143
No files matched your search
@@ -333,7 +333,7 @@ void lcAssetLoader::ProcessPieceCompletion(Completion& Completed)
|
||||
const bool Stale = mStopping || !Current;
|
||||
RequestedPiece->State = Stale ? RequestState::Cancelled : RequestState::AwaitingPublication;
|
||||
|
||||
const bool HasConsumer = mLibrary->HasPieceDataConsumers(PieceData);
|
||||
const bool HasConsumer = RequestedPiece->PieceData.HasOtherReferences();
|
||||
|
||||
if (Stale || !HasConsumer)
|
||||
{
|
||||
@@ -668,7 +668,7 @@ void lcAssetLoader::DispatchNotifications()
|
||||
|
||||
lcPieceData* PieceData = Notification.RequestedPiece->PieceData.Get();
|
||||
|
||||
if (Notification.RequestedPiece->State == RequestState::Cancelled || !mLibrary->HasPieceDataConsumers(PieceData))
|
||||
if (Notification.RequestedPiece->State == RequestState::Cancelled || !Notification.RequestedPiece->PieceData.HasOtherReferences())
|
||||
{
|
||||
Notification.RequestedPiece->PieceData.Reset();
|
||||
|
||||
@@ -703,7 +703,7 @@ void lcAssetLoader::DispatchNotifications()
|
||||
|
||||
lcPieceData* PieceData = Notification.PieceData.Get();
|
||||
|
||||
if (!Notification.RequestedSynth->Cancelled.load(std::memory_order_relaxed) && mLibrary->HasPieceDataConsumers(PieceData) && SettledSynths.insert(PieceData).second)
|
||||
if (!Notification.RequestedSynth->Cancelled.load(std::memory_order_relaxed) && Notification.PieceData.HasOtherReferences() && SettledSynths.insert(PieceData).second)
|
||||
{
|
||||
QPointer<lcAssetLoader> LoaderGuard(this);
|
||||
QPointer<lcPiecesLibrary> LibraryGuard(mLibrary);
|
||||
@@ -1023,7 +1023,7 @@ void lcAssetLoader::CancelUnusedTextureRequests()
|
||||
const std::shared_ptr<TextureRequest>& RequestedTexture = It->second;
|
||||
|
||||
// The request owns one reference; all others belong to consumers.
|
||||
if (RequestedTexture->State == RequestState::AwaitingCompletion || RequestedTexture->Texture->GetRefCount() > 1)
|
||||
if (RequestedTexture->State == RequestState::AwaitingCompletion || RequestedTexture->Texture.HasOtherReferences())
|
||||
{
|
||||
++It;
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user