Re: bug in libgnomecanvas



On 3/17/08, Paul Davis <paul linuxaudiosystems com> wrote:
> i'd file this in bugzilla, but i can't seem to find a sensible component
>  for it. the bug is pretty simple, caused by a misunderstanding of what
>  reserve() does. it was revealed by compiling with _GLIBCXX_DEBUG (as
>  described here:
>
>  http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html)
>
>  Index: libgnomecanvasmm/line.cc
>  ===================================================================
>  --- libgnomecanvasmm/line.cc    (revision 3128)
>  +++ libgnomecanvasmm/line.cc    (working copy)
>  @@ -40,7 +40,9 @@
>   Points::Points(GnomeCanvasPoints *castitem)
>   : points_(castitem),owned_(false)
>   {
>  -  reserve(points_->num_points);
>  +  while (size() < points_->num_points) {
>  +       push_back (Art::Point());
>  +  }
>
>    //GnomeCanvasPoints has an array of doubles, used 2 at a time:
>    int i = 0;
>

I'm just being picky here, but it'd probably be simpler just to do:

assign (points_->num_points, Art::Point());

-- 
jonner


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]