From Robert Milharcic, "This will hopefully fix some issues with osgQt, more precisely with GLWidget event handling. There are at least two current GL context braking events, QEvent::Hide and QEvent::ParentChange. When running in a multithreaded mode they both try to change current GL context in a wrong thread (main GUI thread). The QEvent::ParentChange is also problematic when running in a single threaded model because Qt is going to release current contex then delete it, and then it will create new one, and as a result the osg will continue to render to an invalid deleted context. This changes workaround above problems by deferring execution of the problematic evens. These events has to be enqueued and executed later. The enqueued event processing is currently done right after swap in a swapBuffersImplementation of GraphicsWindowQt while code is running in a render thread by calling QGLWidget handler directly. In principle the deferred events queue should be executed while in GUI thread but I couldn't find any reliable way to do this, that is without risking a deadlock. For now it is assumed, Qt is not going to execute any GUI thread only operations inside the QGLWidget handler."

This commit is contained in:
Robert Osfield
2011-09-13 11:09:39 +00:00
parent 098bc6df5e
commit 64fa6aec43
3 changed files with 133 additions and 20 deletions

View File

@@ -261,7 +261,7 @@ class OSG_EXPORT GraphicsContext : public Object
void removeAllOperations();
/** Run the operations. */
void runOperations();
virtual void runOperations();
typedef std::list< ref_ptr<Operation> > GraphicsOperationQueue;