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

Robert Osfield robert.osfield at gmail.com
Mon Aug 29 07:29:48 PDT 2016

Hi Ricky,

The changes to Drawable and the knock on effect to the callbacks is an
awkward one - it would be easy if it we could just discard backwards
compatibility, so it's a far from ideal code, but alas you can't
rewrite history once it's happened.

>From your description I don't have a clear idea of what is being
called twice and whether this is a problem.  Could you create a small
example that illustrates the problem, once I can see first hand I can
review the behaviour and decide whether this is acceptable or is an


On 29 August 2016 at 15:00, Riccardo Corsi <riccardo.corsi at kairos3d.it> wrote:
> 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
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list