[geos-commits] [SCM] GEOS branch main updated. 1126a86b8fc01a8c05a161cfd8f3a38a95395205
git at osgeo.org
git at osgeo.org
Wed Sep 17 13:24:37 PDT 2025
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, main has been updated
via 1126a86b8fc01a8c05a161cfd8f3a38a95395205 (commit)
from bccdbfa6a7bf77c0283eac6f47e2252b01a4a4ae (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1126a86b8fc01a8c05a161cfd8f3a38a95395205
Author: Chris Thrasher <chrisjthrasher at gmail.com>
Date: Wed Sep 17 14:24:08 2025 -0600
Make `GeometryFactory::addRef/dropRef` thread-safe (#1307)
Even when using the reentrant C API, there are still potential
thread safety issues when incrementing and decrementing
GeometryFactory::_refCount. To fix this, I chose to do what
std::shared_ptr does and make the reference count atomic.
Co-authored-by: Chris Thrasher <Chris_Thrasher at trimble.com>
diff --git a/include/geos/geom/GeometryFactory.h b/include/geos/geom/GeometryFactory.h
index 10c1e867f..125217770 100644
--- a/include/geos/geom/GeometryFactory.h
+++ b/include/geos/geom/GeometryFactory.h
@@ -33,6 +33,7 @@
#include <vector>
#include <memory>
#include <cassert>
+#include <atomic>
namespace geos {
namespace geom {
@@ -522,7 +523,7 @@ private:
PrecisionModel precisionModel;
int SRID;
- mutable int _refCount;
+ mutable std::atomic<int> _refCount;
bool _autoDestroy;
friend class Geometry;
-----------------------------------------------------------------------
Summary of changes:
include/geos/geom/GeometryFactory.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list