mirror of
https://github.com/leozide/leocad.git
synced 2026-10-27 06:20:55 +00:00
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:
1 parent
7e9384ed41
commit
11bbd2a103
2 files changed
+12
-4
No files matched your search
@@ -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
@@ -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>();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user