[Part] - Fix View3DInventor.setCamera leaking SoCamera*

This commit is contained in:
vosk
2021-01-26 22:18:30 +02:00
committed by wmayer
parent 1300c630f4
commit e5b433c17f

View File

@@ -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<SoNode> camPtr(Cam, true);
// toggle between perspective and orthographic camera
if (Cam->getTypeId() != CamViewer->getTypeId())
{