[osg-users] GUIEventHandler called twice - possible bug(s)

Robert Osfield robert.osfield at gmail.com
Thu Oct 6 09:15:11 PDT 2016

HI Riccardo,

I have been back tackling the outstanding OS work today and have a
chance to build and test your callback test. I can recreate the issues
with the crash and double calling.

So far I've fixed a bug in the osgGA/EventVisitor that was causing the
crash and have replaced a couple of dynamic_cast<> in EventHandler
with more efficient as*() calls, and currently investigating the
double calling issue.  I hope to get a fix for this soon, once I do
I'll check in these fixes/refinements to the event callback handling.

FYI, the lack of the bool being passed back by the callback methods
has different meaning depending upon the context.  An event handler
that is handling a single event it returns true if that event is
handled, then the calling code should then set the EventHandled to
true on that event.  For a method handling all the events assigned to
an EventVisitor it will need to do this task itself, and it's return
value is not intended to be used in this way.

The duality is an unfortunate consequence of retaining backwards
compatibility as the various underlying OSG classes have evolved to
become more flexible.  To fix it would require breaking lots of OSG
user code so I've taken the decision to do what I can to offer the new
functionality without breaking backwards compatibility and just have
had to accept it's not as clean as it would have been if we have
started from scratch with the callback API.


More information about the osg-users mailing list