diff --git a/src/Canvas/window.cxx b/src/Canvas/window.cxx index 40dc85500..304f0168c 100644 --- a/src/Canvas/window.cxx +++ b/src/Canvas/window.cxx @@ -24,6 +24,8 @@ #include #include +#include + /** * Callback to enable/disable rendering of canvas displayed inside windows */ @@ -108,7 +110,12 @@ namespace canvas //---------------------------------------------------------------------------- Window::~Window() { - + BOOST_FOREACH(osg::Node* parent, _geometry->getParents()) + { + osg::Geode* geode = dynamic_cast(parent); + if( geode ) + geode->removeDrawable(_geometry); + } } //---------------------------------------------------------------------------- diff --git a/src/Canvas/window.hxx b/src/Canvas/window.hxx index 4b937f357..647bea1ae 100644 --- a/src/Canvas/window.hxx +++ b/src/Canvas/window.hxx @@ -25,6 +25,7 @@ #include +#include #include namespace canvas