title: Adding QPixmap item to QGraphicsScene using QGraphicsScene::addItem crashes PySide
body: <p>I am trying to add an image to a <code>QGraphicsView</code>/<code>QGraphicsScene</code> so later I can paint simple geometries on it based on user's input. I need to make sure that the image fits in <code>QGraphicsView</code> regardless of its aspect ratio. And to do that I am using <code>QGraphicsView::fitInView</code></p>
  
  <h3>Working Version:</h3>
  
  <p>I can add, display and fit the image successfully if I use <a href="http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#addPixmap" rel="noreferrer"><code>QGraphicsScene::addPixmap</code></a></p>
  
  <pre><code>from PySide import QtGui
  import sys
  app = QtGui.QApplication(sys.argv)
  
  scn = QtGui.QGraphicsScene()
  view = QtGui.QGraphicsView(scn)
  
  pixmap = QtGui.QPixmap("image.png")
  gfxPixItem = scn.addPixmap(pixmap)
  
  view.fitInView(gfxPixItem)
  view.show()
  
  sys.exit(app.exec_())
  </code></pre>
  
  <h3>Non-Working Version:</h3>
  
  <p>However if instead of using <code>QGraphicsScene::addPixmap</code>, I first create a <a href="http://qt-project.org/doc/qt-4.8/qgraphicspixmapitem.html" rel="noreferrer"><code>QGraphicsPixmapItem</code></a> and add it to the scene using <code>QGraphicsScene::addItem</code> I get a <strong>segfault</strong>!</p>
  
  <pre><code>from PySide import QtGui
  import sys
  
  app = QtGui.QApplication(sys.argv)
  scn = QtGui.QGraphicsScene()
  view = QtGui.QGraphicsView(scn)
  
  pixmap = QtGui.QPixmap("image.png")
  pixItem = QtGui.QGraphicsPixmapItem(pixmap)
  gfxPixItem = scn.addItem(pixItem)
  
  view.fitInView(gfxPixItem) # Crashes, see below for call stack in OSX
  view.show()
  
  sys.exit(app.exec_())
  </code></pre>
  
  <p>I tried this on OSX as well as Linux with the same result.
  What I am doing wrong here?</p>
  
  <p><em>The reason I need the second approach is so that I can sub-class <code>QGraphicsPixmapItem</code> to reimplement <code>mouseEvent</code> functions.</em></p>
  
  <hr>
  
  <p>This is the thread that crashes:</p>
  
  <pre><code>0   QtGui               0x000000011073bb52 QGraphicsItem::isClipped() const + 4
  1   QtGui               0x0000000110779ad6 QGraphicsView::fitInView(QGraphicsItem const*, Qt::AspectRatioMode) + 32
  2   QtGui.so            0x000000010f72333d Sbk_QGraphicsViewFunc_fitInView + 1153
  3   org.python.python   0x000000010f2895a9 PyEval_EvalFrameEx + 9244
  4   org.python.python   0x000000010f287147 PyEval_EvalCodeEx + 1934
  5   org.python.python   0x000000010f2869b3 PyEval_EvalCode + 54
  6   org.python.python   0x000000010f2c2c70 0x10f270000 + 339056
  7   org.python.python   0x000000010f2c2d3c PyRun_FileExFlags + 165
  8   org.python.python   0x000000010f2c2726 PyRun_SimpleFileExFlags + 410
  9   org.python.python   0x000000010f2e6e27 Py_Main + 2715
  10  libdyld.dylib       0x00007fff861b47e1 start + 1
  </code></pre>