title: Qt program crashes on polyline drawing in Windows
body: <p>I develop a cross platform Qt program which plots a polyline on a QGraphicsScene:</p>
  
  <pre><code>QPolygonF polygon;
  //Init polygon here
  for(int i = 0; i &lt; (polygon.size()-1); i++) {
    float x1 = polygon[i].x();
    float y1 = polygon[i].y();
    float x2 = polygon[i+1].x();
    float y2 = polygon[i+1].y();
    QGraphicsLineItem* item = new QGraphicsLineItem(x2, y2, x1, y1);
    item-&gt;setPen(QPen(QBrush(color), 2));
    item-&gt;setZValue(30);
    item-&gt;setData(0, QVariant((int)value));
    addItem(item);
  }
  </code></pre>
  
  <p>The program crashes on windows when it recieves the following values:</p>
  
  <pre><code> float x1 = 249.573;
   float y1 = 183.471;
   float x2 = 303.983;
   float y2 = 183.45;
  </code></pre>
  
  <p>This polyline is composed of an almost horizontal line. The crash doesn't occur when the line is horizontal or the absolute difference between y1 and y2 is 0 or larger than 0.5.
  It doesn't crash on Ubuntu.</p>
  
  <p>When I change the polyline to a polygon the program doesn't crash. My best, but ugly solution was to draw the polyline as a polygon - append the same points twice to the polygon:</p>
  
  <pre><code>QPolygonF polygon;
  //Init polygon here
  for(int i = polygon.size()-1; i &gt; 0; i--) {
     QPointF point(polygon[i].x(), polygon[i].y());
     polygon.append(point);
  }
  QGraphicsPolygonItem* item = new QGraphicsPolygonItem(polygon);
  item-&gt;setPen(QPen(QBrush(color), 2));
  item-&gt;setZValue(30);
  item-&gt;setData(0, QVariant((int)value));
  addItem(item);
  </code></pre>
  
  <p>I tried to recreate the bug in a small and independent program, that plots a line with the same coordinates on a QGraphicScene. No crash was observed.</p>
  
  <p>Why is this crash happening? Is there a more prettier solution to this bug?</p>
  
  <p>By the way, the call stack in VS2008 debugger tells me that the crash is in malloc.c in msvcr90.dll which is called by QtGui4.dll.</p>
  
  <p>Technicals:</p>
  
  <p>Qt version: 4.7.0</p>
  
  <p>OS: Windows 7 and Ubuntu</p>