From 8545f9e03519e472c9172b9e76dfd5b0378fbecc Mon Sep 17 00:00:00 2001 From: Steve Baer Date: Tue, 1 Feb 2022 09:27:42 -0800 Subject: [PATCH] keep upstream change --- opennurbs_mesh.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opennurbs_mesh.cpp b/opennurbs_mesh.cpp index c7c78cb2..44428ae8 100644 --- a/opennurbs_mesh.cpp +++ b/opennurbs_mesh.cpp @@ -14831,7 +14831,9 @@ bool ON_MeshCache::Transform( ON_Mesh* mesh = item->m_mesh_sp.get(); if (nullptr == mesh || mesh->IsEmpty()) continue; - if (false == item->m_mesh_sp.unique()) + // NOTE: use_count() == 1 is an approximation in multi-threaded environments + // https:// en.cppreference.com/w/cpp/memory/shared_ptr/unique + if (item->m_mesh_sp.use_count() != 1) { // make a copy and transform the copy std::shared_ptr(new ON_Mesh(*mesh)).swap(item->m_mesh_sp);