From e5b433c17fb9280340f05e965437bb93d1cbbd35 Mon Sep 17 00:00:00 2001 From: vosk Date: Tue, 26 Jan 2021 22:18:30 +0200 Subject: [PATCH] [Part] - Fix View3DInventor.setCamera leaking SoCamera* --- src/Gui/View3DInventor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 396da77057..ee55f39111 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -774,10 +774,13 @@ bool View3DInventor::setCamera(const char* pCamera) SoNode * Cam; SoDB::read(&in,Cam); - if (!Cam){ + if (!Cam || !Cam->isOfType(SoCamera::getClassTypeId())) { throw Base::RuntimeError("Camera settings failed to read"); } + // this is to make sure to reliably delete the node + CoinPtr camPtr(Cam, true); + // toggle between perspective and orthographic camera if (Cam->getTypeId() != CamViewer->getTypeId()) {