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

Robert Osfield robert.osfield at gmail.com
Mon Aug 29 09:45:08 PDT 2016


Thanks Riccardo.  I'm currently submerged in refactoring osgParticle,
once this is completed I'll have a look at the modified
osgcallback.cpp.

On 29 August 2016 at 16:20, Riccardo Corsi <riccardo.corsi at kairos3d.it> wrote:
> Hi Robert,
>
> please find attached a simple example that shows the issues I was trying to
> explain:
> - launch with no args to see the initial issue
> - launch with "--crash" to get the crash i ran into when implementing the
> callback deriving from osg::Callback
> - launch with "--fix" to see the way I fixed it with the NodeCallback:
> comments on the run() and operator() methods explain some concerns for this
> solution
>
> Hope this clarifies things :)
> Ricky
>
>
> On Mon, Aug 29, 2016 at 4:29 PM, Robert Osfield <robert.osfield at gmail.com>
> wrote:
>>
>> 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
>> bug.
>>
>> Thanks,
>> Robert.
>>
>> 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
>> >
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>
> _______________________________________________
> 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