Paul Melis wrote:
Paul Melis wrote:
I don't think there's an easy way out for this one, as wxWidgets uses a different memory management strategy than OSG. Even removing the GraphicsWindowWX as child of the main frame just before exit forces destruction. IMHO GraphicsWindowWX shouldn't inherit from both a wxWidgets class and an OSG class, as the former uses explicit memory management, while the latter uses an implicit style (through osg::Referenced and osg::ref_ptr).

A better solution would probably be to split GraphicsWindowWX into a class derived from wxGLCanvas and one derived from osgViewer::GraphicsWindow. The latter would then need to define some custom events for the different events handled by GraphicsWindow and use wxPostEvent to post these to the derived canvas class. But I'd need to try it out to see how this works out.
Here's the osgviewerWX example reworked to do the split described above. I'll submit it to osg-submissions later. Perhaps this can help you now.
Replying to myself...
It actually doesn't use events to communicate between the two parts, but simple method calls. In case GraphicsWindowWX's methods can be called from a different thread than the main GUI loop it will need to use wxPostEvent. Wether this happens in practice might be related to the active threading mode, but I'm not really sure.

Paul

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to