From 052d5784831bb0bf42af4edfb614ba7339066492 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 5 Aug 2012 18:06:56 +0200 Subject: [PATCH] Canvas: Fully remove Window drawable if destroyed --- src/Canvas/window.cxx | 9 ++++++++- src/Canvas/window.hxx | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) 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 -- 2.39.5