Guard asset readiness and buffer cleanup without renderer state

Skip container bounds publication for temporary models without a PieceInfo. Avoid accessing the GL context when releasing an empty shared buffer set while preserving dirty-state tracking.
This commit is contained in:
Leonardo Zide committed 2026-09-29 23:17:55 -07:00
1 parent 7e9384ed41
commit 11bbd2a103
2 files changed
+12 -4

No files matched your search

+6 -2
View File
@@ -2038,13 +2038,17 @@ void lcPiecesLibrary::GetPieceFile(const char* PieceName, std::function<void(lcF
void lcPiecesLibrary::ReleaseBuffers()
{
mBuffersDirty = true;
// Library-only loading can finish without creating a renderer or shared buffers.
if (!mVertexBuffer.IsValid() && !mIndexBuffer.IsValid())
return;
lcContext* Context = lcContext::GetGlobalOffscreenContext();
Context->MakeCurrent();
Context->DestroyVertexBuffer(mVertexBuffer);
Context->DestroyIndexBuffer(mIndexBuffer);
mBuffersDirty = true;
}
void lcPiecesLibrary::UpdateBuffers(lcContext* Context)
+6 -2
View File
@@ -549,8 +549,12 @@ lcResult<void> lcModel::EnsureAssetsReady() const
}
}
std::vector<lcModel*> UpdatedModels;
const_cast<lcModel*>(this)->UpdatePieceInfo(UpdatedModels);
// Temporary minifigure and thumbnail models have no container piece to update.
if (mPieceInfo)
{
std::vector<lcModel*> UpdatedModels;
const_cast<lcModel*>(this)->UpdatePieceInfo(UpdatedModels);
}
return lcResult<void>();
}