From 0aed782a47351de84692dce166097793242588c7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 10 Oct 2009 09:26:06 +0000 Subject: [PATCH] From Jean-Sebastien Guay, "osgWidget::Window::setWindow() calls parented() (which does an addChild()) on the new window, but it does not call unparented() (which does a removeChild()) on the old window before. So it works fine if there was no window previously, but if an app creates new windows and calls setWindow() to replace the previous one, they will all add up instead and be on top of each other... This is fixed in the file attached." --- src/osgWidget/Window.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/osgWidget/Window.cpp b/src/osgWidget/Window.cpp index c6076ce9e..b916988c2 100644 --- a/src/osgWidget/Window.cpp +++ b/src/osgWidget/Window.cpp @@ -115,6 +115,9 @@ bool Window::EmbeddedWindow::setWindow(Window* win) { return false; } + if (_window.valid() && _parent) + unparented(_parent); + _window = win; _window->resize();