[osg-users] Bug in RenderBin (?)

Robert Osfield robert.osfield at gmail.com
Thu Mar 12 03:37:55 PDT 2009

HI David & Christof et. al,

On Thu, Mar 12, 2009 at 10:13 AM, David Callu <ledocc at gmail.com> wrote:
> What is smells fishy is the use of "proto->className()" to identify the
> renderBin prototype to remove in removeRenderBinPrototype();

Well spotted David, the addRenderBinPrototype() correctly uses
binName, while the removeRenderBinProtoype() attempts to use the
className() as it's binName.  The later is definitely a bug, and one
that is easy to fix...

> Instead, in "void RenderBin::removeRenderBinPrototype(RenderBin* proto)" we
> need something like this
> <code>
> void RenderBin::removeRenderBinPrototype(const std::string & binName,
> RenderBin* proto)
> {
>     RenderBinPrototypeList* list = renderBinPrototypeList();
>     if (list && proto)
>     {
>         RenderBinPrototypeList::iterator itr = list->find(binName);
>         if (itr != list->end()) list->erase(itr);
>     }
> }
> </code>
> Thought ?

There is no need to use the binName, one just needs to search for the
pointer in the map by hand, and remove it.

I'm just tested the following code and it looks to be working properly :

void RenderBin::removeRenderBinPrototype(RenderBin* proto)
    RenderBinPrototypeList* list = renderBinPrototypeList();
    if (list && proto)
        for(RenderBinPrototypeList::iterator itr = list->begin();
            itr != list->end();
            if (itr->second == proto)

I've attached the modified file.  Christof could you test this and let
me know how you get on.  If things look fine I'll check the changes
into svn/trunk and OSG-2.8 branch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: RenderBin.cpp
Type: text/x-c++src
Size: 16822 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090312/1b1372fb/attachment-0003.cpp>

More information about the osg-users mailing list