[geos-commits] [SCM] GEOS branch main updated. 5ae8f7c6499b41e650e389a1c9eb2a81025b252c

git at osgeo.org git at osgeo.org
Fri May 1 05:46:24 PDT 2026


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  5ae8f7c6499b41e650e389a1c9eb2a81025b252c (commit)
      from  789196b9e19eed3299f47ea5437ac089ac841e7d (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 5ae8f7c6499b41e650e389a1c9eb2a81025b252c
Author: Daniel Baston <dbaston at gmail.com>
Date:   Fri May 1 08:45:59 2026 -0400

    CircularArc: Handle self-assignment (#1431)
    
    Resolves https://github.com/libgeos/geos/issues/1430

diff --git a/src/geom/CircularArc.cpp b/src/geom/CircularArc.cpp
index 1bca8155a..7dfcbbf34 100644
--- a/src/geom/CircularArc.cpp
+++ b/src/geom/CircularArc.cpp
@@ -142,6 +142,10 @@ CircularArc::CircularArc(CircularArc&& other) noexcept {
 CircularArc&
 CircularArc::operator=(const CircularArc& other)
 {
+    if (this == &other) {
+        return *this;
+    }
+
     if (m_own_coordinates) {
         delete m_seq;
     }
diff --git a/tests/unit/geom/CircularArcTest.cpp b/tests/unit/geom/CircularArcTest.cpp
index 67df5734a..47078db1f 100644
--- a/tests/unit/geom/CircularArcTest.cpp
+++ b/tests/unit/geom/CircularArcTest.cpp
@@ -148,4 +148,32 @@ void object::test<6>() {
     ensure_equals(c1, c2);
 }
 
+template<>
+template<>
+void object::test<7>() {
+    set_test_name("self-assignment");
+
+    CoordinateXY p0(0.0, 0.0);
+    CoordinateXY p1(1.0, 1.0);
+    CoordinateXY p2(2.0, 0.0);
+
+    CircularArc arc = CircularArc::create(p0, p1, p2);
+
+    const auto radius = arc.getRadius();
+    const auto center = arc.getCenter();
+    const auto orientation = arc.getOrientation();
+
+    CircularArc* arcPtr = &arc;
+    *arcPtr = arc;
+
+    ensure_equals(arc.p0(), p0);
+    ensure_equals(arc.p1(), p1);
+    ensure_equals(arc.p2(), p2);
+
+    ensure_equals(arc.getRadius(), radius);
+    ensure_equals(arc.getCenter(), center);
+    ensure_equals(arc.getOrientation(), orientation);
+}
+
+
 }

-----------------------------------------------------------------------

Summary of changes:
 src/geom/CircularArc.cpp            |  4 ++++
 tests/unit/geom/CircularArcTest.cpp | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list