From 07e189d4bc353b04f712085acf309d8b34ba32e1 Mon Sep 17 00:00:00 2001 From: Andrei Gheata Date: Thu, 3 Sep 2026 11:22:43 +0200 Subject: [PATCH] [geom] Fix Windows linkage for shape TLS access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TGeoPgon::GetThreadData() and TGeoXtru::GetThreadData() are inline, so consumer translation units directly reference fgInstanceCount. On Windows, automatically exporting DLL symbols does not provide the dllimport semantics required for static data, resulting in unresolved external symbols when linking clients. The counter was only used to pre-size the TLS vector. Resize it to fIndex + 1 instead, which is sufficient to access the object’s non-reused slot and avoids the DLL data reference. --- geom/geom/inc/TGeoPgon.h | 2 +- geom/geom/inc/TGeoXtru.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/geom/geom/inc/TGeoPgon.h b/geom/geom/inc/TGeoPgon.h index 7c26d63aa9250..853fba11091c0 100644 --- a/geom/geom/inc/TGeoPgon.h +++ b/geom/geom/inc/TGeoPgon.h @@ -39,7 +39,7 @@ class TGeoPgon : public TGeoPcon { { thread_local std::vector tdata; if (tdata.size() <= fIndex) - tdata.resize(std::max(fgInstanceCount.load(std::memory_order_relaxed), fIndex + 1)); + tdata.resize(fIndex + 1); ThreadData_t &td = tdata[fIndex]; if (td.fInitGen != fGeneration.load(std::memory_order_acquire)) InitThreadSlot(td); diff --git a/geom/geom/inc/TGeoXtru.h b/geom/geom/inc/TGeoXtru.h index eb2e21412d3a3..3e1c59c2b6a7f 100644 --- a/geom/geom/inc/TGeoXtru.h +++ b/geom/geom/inc/TGeoXtru.h @@ -45,7 +45,7 @@ class TGeoXtru : public TGeoBBox { { thread_local std::vector tdata; if (tdata.size() <= fIndex) - tdata.resize(std::max(fgInstanceCount.load(std::memory_order_relaxed), fIndex + 1)); + tdata.resize(fIndex + 1); ThreadData_t &td = tdata[fIndex]; if (td.fInitGen != fGeneration.load(std::memory_order_acquire)) InitThreadSlot(td);