From: Thomas Geymayer Date: Sun, 5 Aug 2012 16:06:56 +0000 (+0200) Subject: Canvas: Fully remove Window drawable if destroyed X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=052d5784831bb0bf42af4edfb614ba7339066492;p=flightgear.git Canvas: Fully remove Window drawable if destroyed --- 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