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

Riccardo Corsi riccardo.corsi at kairos3d.it
Mon Aug 29 07:00:07 PDT 2016


Hi all,

I report what I believe could be considered a bug, probably introduced
after the promotion of the Drawable class to a node, together with the new
callback system.

I have a GUIEventHandler derived class installed on a Drawable.
After some digging I've realized that it's called twice for every event due
to the EventVisitor code here: https://github.com/
openscenegraph/OpenSceneGraph/blob/master/include/osgGA/EventVisitor#L86

GUIEventHandler happens to derive both from NodeCallback
and DrawableEventCallback, resulting in it being called twice. I think this
might be considered as a bug if the intended behavior was to keep using the
old GUIEventHandler interface the way it was (when attached to the viewer
for instance, it is called only once as expected).

Relate issue:
I've re-implemented my callback deriving from osg::Callback, but this
results in a crash as the osg::CallbackObject interface is used even if the
cast does not succeed (first if condition)
https://github.com/openscenegraph/OpenSceneGraph/blob/master/include/osgGA/EventVisitor#L93

I fixed that by deriving from osg::NodeCallback, but I had to reimplement
the operator() method instead of run(), as the second is not called by the
visitor - that also it's a bit counter-intuitive with respect to the
osg::Callback class interface.

Ricky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160829/31dfb163/attachment-0001.htm>


More information about the osg-users mailing list