I am running OSG 2.8.3 (latest stable build) on XP compiled in VS2008.
My application is using a GraphicsWindowEmbedded object.
Here is the code snippets pertaining to it.
In the .h file:
Code:
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> theGraphicWindow;
In the .cpp constructor:
theGraphicWindow = new osgViewer::GraphicsWindowEmbedded(0, 0, width(),
height());
// where width() returns 1020 and height() returns 720
cerr<<"Checking references to each of theGraphicWindow parts:"<<endl
<<" theGraphicWindow: "<<theGraphicWindow->referenceCount()<<endl
<<" EventQueue: "<<theGraphicWindow->getEventQueue()->referenceCount()<<endl
<<" GUIAdapter:
"<<theGraphicWindow->getEventQueue()->getCurrentEventState()->referenceCount()
<< endl;
The cerr output is:
Checking references to each of theGraphicWindow parts:
theGraphicWindow: 1
EventQueue: 4502986
GUIAdapter: 4552084
Shortly after the constructor, on another start-up call my application makes a
call:
Code:
theGraphicWindow->getEventQueue()->windowResize(0, 0, width, height);
And at this point the application crashes.
I've instrumented OSG to get some output and the actual line at which the crash
occurs is simply the first assignment statement to one of its
class variables:
_windowX = x;
within GUIEventAdapter::setWindowRectangle(int x, int y, int width, int height,
bool updateMouseRange).
Tracing the construct down to that level:
GraphicsWindowEmbedded::public GraphicsWindow
GraphicsWindow
contains
osgGA::EventQueue _eventQueue;
In its constructor:
GraphicsWindow() { _eventQueue = new osgGA::EventQueue;
_eventQueue->setGraphicsContext(this); }
EventQueue
contains
GUIEventAdapter _accumulateEventState;
In its constructor:
_accumulateEventState = new GUIEventAdapter();
GUIEventAdapter
contains
int _windowX;
along with the other event tracking variables.
So, judging by my output, it seems as though the GraphicsWindow somehow loses
its reference to
the EventQueue as a check of the referenceCount() seems to be garbage.
I did check the referenceCount to _accumulateEventState after it is created in
the EventQueue
constructor and it is set at 1 which indicates it appears to be okay.
I have these same code sets (my application and OSG 2.8.3) built in VS2003 and
do not have this
issue but other libraries force me to move on to VS2008. The output from the
VS2003 version is:
Checking references to each of theGraphicWindow parts:
theGraphicWindow: 1
EventQueue: 1
GUIAdapter: 1
Are there any suggestions as to what might be missing or changes that I'd need
to the OSG build?
Thanks for your time,
Tom
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38228#38228
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org