fix several reference counting bugs
This commit is contained in:
@@ -1159,6 +1159,10 @@ SoBoxSelectionRenderAction::constructorCommon(void)
|
||||
|
||||
SoBoxSelectionRenderAction::~SoBoxSelectionRenderAction(void)
|
||||
{
|
||||
// clear highlighting node
|
||||
if (PRIVATE(this)->highlightPath) {
|
||||
PRIVATE(this)->highlightPath->unref();
|
||||
}
|
||||
PRIVATE(this)->postprocpath->unref();
|
||||
PRIVATE(this)->localRoot->unref();
|
||||
|
||||
@@ -1218,6 +1222,10 @@ SoBoxSelectionRenderAction::apply(SoNode * node)
|
||||
if (shapepath) {
|
||||
SoPathList list;
|
||||
list.append(shapepath);
|
||||
// clear old highlighting node if still active
|
||||
if (PRIVATE(this)->highlightPath) {
|
||||
PRIVATE(this)->highlightPath->unref();
|
||||
}
|
||||
PRIVATE(this)->highlightPath = path;
|
||||
PRIVATE(this)->highlightPath->ref();
|
||||
this->drawBoxes(path, &list);
|
||||
@@ -1262,6 +1270,10 @@ SoBoxSelectionRenderAction::apply(SoPath * path)
|
||||
if (shapepath) {
|
||||
SoPathList list;
|
||||
list.append(shapepath);
|
||||
// clear old highlighting node if still active
|
||||
if (PRIVATE(this)->highlightPath) {
|
||||
PRIVATE(this)->highlightPath->unref();
|
||||
}
|
||||
PRIVATE(this)->highlightPath = path;
|
||||
PRIVATE(this)->highlightPath->ref();
|
||||
this->drawBoxes(path, &list);
|
||||
|
||||
@@ -578,6 +578,14 @@ View3DInventorViewer::~View3DInventorViewer()
|
||||
static_cast<View3DInventorViewerPy*>(_viewerPy)->_viewer = 0;
|
||||
Py_DECREF(_viewerPy);
|
||||
}
|
||||
|
||||
// In the init() function we have overridden the default SoGLRenderAction with our
|
||||
// own instance of SoBoxSelectionRenderAction and SoRenderManager destroyed the default.
|
||||
// But it does this only once so that now we have to explicitly destroy our instance in
|
||||
// order to free the memory.
|
||||
SoGLRenderAction* glAction = this->getSoRenderManager()->getGLRenderAction();
|
||||
this->getSoRenderManager()->setGLRenderAction(nullptr);
|
||||
delete glAction;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::aboutToDestroyGLContext()
|
||||
|
||||
Reference in New Issue
Block a user