]> git.mxchange.org Git - flightgear.git/commitdiff
Canvas: Fully remove Window drawable if destroyed
authorThomas Geymayer <tomgey@gmail.com>
Sun, 5 Aug 2012 16:06:56 +0000 (18:06 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 5 Aug 2012 16:06:56 +0000 (18:06 +0200)
src/Canvas/window.cxx
src/Canvas/window.hxx

index 40dc855002c88bdae2f2f15b00438a72903b79e8..304f0168c4184918f183e1d9d3e2c34ca8fda32e 100644 (file)
@@ -24,6 +24,8 @@
 #include <osg/Texture2D>
 #include <osgGA/GUIEventHandler>
 
+#include <boost/foreach.hpp>
+
 /**
  * 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<osg::Geode*>(parent);
+      if( geode )
+        geode->removeDrawable(_geometry);
+    }
   }
 
   //----------------------------------------------------------------------------
index 4b937f3572a5f45a971ded7b0fd45d180ad89046..647bea1ae9d6874ca230d5f1f4eac8a4052a3cbf 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <simgear/props/propertyObject.hxx>
 
+#include <osg/Geode>
 #include <osg/Geometry>
 
 namespace canvas