bug in libgnomecanvas



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;




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