Skip to content

Commit

Permalink
solidtest: Fix segfault in setExteriorShell test
Browse files Browse the repository at this point in the history
For the pointer version, The `Polyhedralsurface` takes ownership of
the shell.

This fixes commit 481cce2.
  • Loading branch information
ptitjano committed Oct 25, 2024
1 parent f29b0d6 commit d8a2a53
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/unit/SFCGAL/SolidTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "SFCGAL/Kernel.h"

#include "SFCGAL/Solid.h"
#include "SFCGAL/PolyhedralSurface.h"
#include "SFCGAL/TriangulatedSurface.h"
#include "SFCGAL/io/wkt.h"
#include "SFCGAL/algorithm/covers.h"
Expand Down Expand Up @@ -130,7 +131,7 @@ BOOST_AUTO_TEST_CASE(solidSetExteriorRingTest)
BOOST_CHECK(!shell1->isEmpty());
BOOST_CHECK(solid->isEmpty());

solid->setExteriorShell(shell1);
solid->setExteriorShell(dynamic_cast<PolyhedralSurface *>(shell1.get())->clone());
BOOST_CHECK_EQUAL(solid->numShells(), 1);
BOOST_CHECK(!solid->isEmpty());
BOOST_CHECK(algorithm::covers3D(solid->exteriorShell(), *shell1));
Expand Down
2 changes: 1 addition & 1 deletion test/unit/SFCGAL/capi/sfcgal_cTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ BOOST_AUTO_TEST_CASE(testSolidSetExteriorShell)
std::unique_ptr<Geometry> shell1(io::readWkt(polyhedral1Str));
BOOST_CHECK(!shell1->isEmpty());

sfcgal_solid_set_exterior_shell(solid.get(), shell1.get());
sfcgal_solid_set_exterior_shell(solid.get(), sfcgal_geometry_clone(shell1.get()));

// check
BOOST_CHECK(!solid->isEmpty());
Expand Down

0 comments on commit d8a2a53

Please sign in to comment.