<div dir="ltr"><div dir="ltr">Hi Chris,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 26 Jul 2019 at 00:38, Chris Djali <<a href="mailto:krizdjali@gmail.com">krizdjali@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I have more information. The GraphicsContext is only referenced by the camera when the camera is destroyed. The camera detaches itself from the graphics context in its destructor, then the camera's ref_ptr to the graphics context is destroyed, triggering the destruction of the graphics context. The graphics context calls its own close in its destructor, but by then the camera has already detached itself, so it's not helpful.<br></blockquote><div><br></div><div>I don't recall the reason for the current form of the Camera destructor, it's current incarnation is:</div><div><br></div><div>Camera::~Camera()<br>{<br>    setCameraThread(0);<br><br>    if (_graphicsContext.valid()) _graphicsContext->removeCamera(this);<br>}<br></div><div> </div><div>So if the GraphicsContext hasn't already been closed then the removeCamera above would prevent the releaseGLObjects() being called on the Camera.</div><div><br></div><div>So... would change the destructor to:</div><div><br></div><div><div>Camera::~Camera()<br>{<br>    setCameraThread(0);</div><div><br>    if (_graphicsContext.valid()) <br></div><div>    {</div><div>       releaseGLObjects(_graphicsContext->getState());</div><div><br></div><div>        _graphicsContext->removeCamera(this);</div><div>    }</div><div>    else</div><div>    {</div><div>        releaseGLObjects();<br></div><div>    }<br></div></div><div>}</div><div><br></div><div>Work for your usage case?</div><div><br></div><div>Robert.<br></div></div></div>