diff --git a/src/bindings/bnd_3dm_settings.cpp b/src/bindings/bnd_3dm_settings.cpp index f7cecaca..f0f67d5c 100644 --- a/src/bindings/bnd_3dm_settings.cpp +++ b/src/bindings/bnd_3dm_settings.cpp @@ -75,7 +75,7 @@ BND_RenderSettings::~BND_RenderSettings() void BND_RenderSettings::Construct() { - m_ground_plane = new BND_File3dmGroundPlane (&m_render_settings->GroundPlane()); + m_ground_plane = new BND_File3dmGroundPlane (std::shared_ptr(&m_render_settings->GroundPlane())); m_safe_frame = new BND_File3dmSafeFrame (&m_render_settings->SafeFrame()); m_dithering = new BND_File3dmDithering (&m_render_settings->Dithering()); m_skylight = new BND_File3dmSkylight (&m_render_settings->Skylight()); diff --git a/src/bindings/bnd_ground_plane.cpp b/src/bindings/bnd_ground_plane.cpp index 60fcb298..6aae6c67 100644 --- a/src/bindings/bnd_ground_plane.cpp +++ b/src/bindings/bnd_ground_plane.cpp @@ -3,19 +3,17 @@ BND_File3dmGroundPlane::BND_File3dmGroundPlane() { - _gp = new ON_GroundPlane; - _owned = true; + _gp = std::make_shared(); } BND_File3dmGroundPlane::BND_File3dmGroundPlane(const BND_File3dmGroundPlane& gp) { - _gp = new ON_GroundPlane(*gp._gp); - _owned = true; + _gp = gp._gp; } -BND_File3dmGroundPlane::BND_File3dmGroundPlane(ON_GroundPlane* gp) -: _gp(gp) +BND_File3dmGroundPlane::BND_File3dmGroundPlane(std::shared_ptr gp) { + _gp = gp; } #if defined(ON_PYTHON_COMPILE) diff --git a/src/bindings/bnd_ground_plane.h b/src/bindings/bnd_ground_plane.h index e6db9ea4..6d8a7d81 100644 --- a/src/bindings/bnd_ground_plane.h +++ b/src/bindings/bnd_ground_plane.h @@ -12,14 +12,12 @@ void initGroundPlaneBindings(void* m); class BND_File3dmGroundPlane { private: - ON_GroundPlane* _gp = nullptr; - bool _owned = false; + std::shared_ptr _gp; public: BND_File3dmGroundPlane(); - BND_File3dmGroundPlane(ON_GroundPlane* gp); + BND_File3dmGroundPlane(std::shared_ptr gp); BND_File3dmGroundPlane(const BND_File3dmGroundPlane& gp); - ~BND_File3dmGroundPlane() { if (_owned) delete _gp; } bool GetEnabled(void) const { return _gp->Enabled(); } void SetEnabled(bool v) { _gp->SetEnabled(v); }