From 1fc382867dfca15a5d1e21ab6cc111d7004f3fc1 Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Tue, 15 Apr 2025 18:39:06 +0200 Subject: [PATCH] Fix segfault in occ (use Handle when creating new Geom_Plane) --- libsrc/occ/python_occ_shapes.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 76949344..795a7947 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1964,21 +1964,21 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) }) .def("Edge", [](Handle(Geom2d_Curve) curve) { // static Geom_Plane surf{gp_Ax3()}; // crashes in nbconvert ??? - static auto surf = new Geom_Plane{gp_Ax3()}; + static auto surf = Handle(Geom_Plane)(new Geom_Plane{gp_Ax3()}); auto edge = BRepBuilderAPI_MakeEdge(curve, surf).Edge(); BRepLib::BuildCurves3d(edge); return edge; }) .def("Wire", [](Handle(Geom2d_Curve) curve) { // static Geom_Plane surf{gp_Ax3()}; // crashes in nbconvert ??? - static auto surf = new Geom_Plane{gp_Ax3()}; + static auto surf = Handle(Geom_Plane)(new Geom_Plane{gp_Ax3()}); auto edge = BRepBuilderAPI_MakeEdge(curve, surf).Edge(); BRepLib::BuildCurves3d(edge); return BRepBuilderAPI_MakeWire(edge).Wire(); }) .def("Face", [](Handle(Geom2d_Curve) curve) { // static Geom_Plane surf{gp_Ax3()}; // crashes in nbconvert ??? - static auto surf = new Geom_Plane{gp_Ax3()}; + static auto surf = Handle(Geom_Plane)(new Geom_Plane{gp_Ax3()}); auto edge = BRepBuilderAPI_MakeEdge(curve, surf).Edge(); BRepLib::BuildCurves3d(edge); auto wire = BRepBuilderAPI_MakeWire(edge).Wire();