[osg-users] ViewerQT destruction

Robert Osfield robert.osfield at gmail.com
Wed Jul 2 08:58:36 PDT 2008

Hi Virginia,

There is not much I can do without seeing the problem first hand.  Is
it possible to recreate it by modifying the existing osgviewerQT
example?  If so, could do this to effectively create a unit test for
this particular usage case.

Another possible route with solving this type of usage case might be
to explicitly pass in the parent window when creating the graphics
context, but leave it to the OSG itself to create the windows rather
that QT.  I haven't personally tried this, but it should be possible,
even if it requires a few tweaks to the OSG itself to enable it.


On Wed, Jul 2, 2008 at 3:22 PM, Virginia Holmstrom
<v.holmstrom at ama-inc.com> wrote:
> Hello
> I have been having problems with the destruction of my ViewerQT window and I was wondering if anyone could shed some light on the issue. I am seeing corruption in one view when another view is deleted (screen shot attached). We are using OSG 2.4 and Qt 3.3.3 on WindowsXP and Linux. Problems are reproducible on both platforms.
> We are required to permit muliple views into the same scene, each in its own window with its own navigation. The user may open one or more views, close views at anytime, and open new ones. We have a set up similar to the osgViewerQT example shipped with osg, where our ViewerQT inherits from both osgViewer::Viewer and the AdapterWidget. We actually flipped the inheritance order from the example, so that ours looks like this: ViewerQT : public AdapterWidget, public osgViewer::Viewer
> due to compilation problems with the Qt moc'ing the other way around.
> Note we are using QGLWidget, not QOSGWidget, and we use multiple ViewerQts instead of CompositeViewer due to problems discussed in thread http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2007-December/005676.html. Hence our use of multiple ViewerQts is also similar to Enrique Parodi's implementation he provided in that thread.
> We store a ref_ptr to the root node of our scene external to the ViewerQts.
> osg::ref_ptr < osg::Group > _osgScene;
> This ref_ptr persists as views are opened and closed and is only released when the application closes. Each time a ViewerQT is created we pass it the scene using setSceneData. All ViewerQts get the same root scene node.
> We started having a problem when we set the Qt::WDestructiveClose flag in our AdapterWidget, which triggers the following destructors to be called in this order on close:
> ViewerQT
> osgViewer::Viewer
> osgViewer::View
> osg::View
> AdapterWidget
> We normally perform cleanup of our own classes in ViewerQT::~ViewerQT, however we see the corruption when the ViewerQT destructor is empty as well! The AdapterWidget destructor contains _gw->getEventQueue()->closeWindow();
> The easiest way to reproduce the problem is to open multiple windows, then close the first window(view), triggering its destruction. Frequently the last window will be corrupted. I use corruption for lack of a better term. Geometry may disappear, textures may disappear, osgText may become blocks, while other parts of the scene are still visible in their original form. We've also had problems with the background stars flipping to an opaque dome.
> In the screen shot provided I closed the first window (hence blank space upper left) and immediatly as I did that portions of the scene disappeard from the last window (bottom right) and the text became blocks.
> If I subsequently open a new window the scene usually appears normal.
> I am not sure if I have a:
> memory problem?
> problem with the shared scene when ViewerQTs destruct?
> problem in the GraphicsWindowEmbedded?
> QT problem?
> ???
> I am very open to suggestions. ;-)
> Thank you so much,
> Virginia
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list