Hi Michael,
The file came through just fine this time, thanks.
I'm reviewing the change and won't merge just yet as it took me a
little while to figure out what the code was trying to do and the
problem it was addressing. Code this is difficult for me to get my
head around will be difficult for other too so may lead to mistakes in
adjusting the code in the future so I'd like to refactor the code make
it more readable even if its a bit more long winded.
The original code is:
Particle_vector::const_iterator i;
Particle_vector::const_iterator i0 = _particles.begin();
Particle_vector::const_iterator end = _particles.end();
i0->beginRender();
float scale = sqrtf(static_cast<float>(_detail));
for (i=i0; i<end; i+=_detail) {
...
}
To me it looks like the original code should work as it, and the i
iterator should never be accessed when it goes beyond the end of the
vector it is iterating over as the iterator is incremented by _detail
at the end of the for loop scope then the i<end is tested and should
fail, for instance if i points to entry 10 and there are only end
point to entry 9 it should return false.
To me you bug fix clamps the increment so the last iteration of the
loop take you to where i==end, which fails correctly.
Is this a correct analysis? If so it suggest that the STL
implementation of std::vector::iterator fails when i>end returning
true for i<end expression in this case.
Robert.
Robert.
On Feb 18, 2008 8:46 PM, Michael Ebner <[EMAIL PROTECTED]> wrote:
> Hi Robert,
>
> buggy thunderbird :-(
> attached a .zip, should finally work now.
>
>
> regards,
> Michael.
>
>
>
> Robert Osfield wrote:
> > Hi Michael,
> >
> > It still came through inlined I'm afraid. Some mail tools are buggy.
> > Could you send as a zipped file.
> >
> > On Feb 18, 2008 2:42 PM, Michael Ebner <[EMAIL PROTECTED]> wrote:
> >> Hi Robert,
> >>
> >> thanks, disabled auto-inlining attachments, it should work now.
> >>
> >> regards,
> >> Michael.
> >>
> >>
> >>
> >> Robert Osfield wrote:
> >>> HI Michael,
> >>>
> >>> You you send the file zipped up as the file has come through inline
> >>> (some emailer inline by default for text files). More details can be
> >>> found at:
> >>>
> >>>
> >>> http://www.openscenegraph.org/projects/osg/wiki/MailingLists/SubmissionsProtocol
> >>>
> >>> Robert.
> >>>
> >>> On Feb 18, 2008 11:22 AM, Michael Ebner <[EMAIL PROTECTED]> wrote:
> >>>> Hello,
> >>>>
> >>>> the osgParticle LOD functionality is still marked experimental. I tested
> >>>> it on Win2K and found an error where a std::vector iterator goes beyond
> >>>> the end of the vector, which is not handled on Win32 STL implementation.
> >>>> Therfore when using particle LOD the application crashed.
> >>>>
> >>>> Attached is a fix that avoids the iterator problem described above.
> >>>> Could someone check (and notify me please) if this patch is ok and if
> >>>> this is the only reason why particle LOD is marked experimental?
> >>>>
> >>>> thanks,
> >>>> Michael.
> >>>>
> >>>>
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org