qt5base-lts/tests/auto/widgets/graphicsview
Marc Mutz e2e107556d tst_QGraphicsItem: Fix UB (invalid cast/member call) in prepareGeometryChange()
Found by UBSan:

  tst_qgraphicsitem.cpp:5066:29: runtime error: downcast of address 0x2afcb006c7f0 which does not point to an object of type 'GeometryChanger'
  0x2afcb006c7f0: note: object is of type 'QGraphicsRectItem'
   00 00 00 00  d8 64 ca 98 fc 2a 00 00  40 a9 0b b0 fc 2a 00 00  75 65 29 00 00 00 00 00  35 00 00 00
                ^~~~~~~~~~~~~~~~~~~~~~~
                vptr for 'QGraphicsRectItem'
      #0 0x4c5f1c in tst_QGraphicsItem::prepareGeometryChange() tst_qgraphicsitem.cpp:5066

Fix by actually instantiating a GeometryChanger, which incidentally is
the pattern used by paint() a few lines below, too.

While at it, allocate the item on the stack (as is done in paint())
and create a local QRectF variable to avoid repeating the same magic
numbers over and over again.

Change-Id: If5a3d56511000a17703d78d7dd1f0ea072b8bc11
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-22 15:25:18 +00:00
..
qgraphicsanchorlayout tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qgraphicsanchorlayout1 tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qgraphicseffectsource Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicsgridlayout Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicsitem tst_QGraphicsItem: Fix UB (invalid cast/member call) in prepareGeometryChange() 2016-09-22 15:25:18 +00:00
qgraphicsitemanimation Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicslayout tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qgraphicslayoutitem Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicslinearlayout Remove empty first lines of files. 2016-04-06 18:26:26 +00:00
qgraphicsobject tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qgraphicspixmapitem Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicspolygonitem Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicsproxywidget Fix memory leak in tst_qgraphicsproxywidget 2016-08-10 11:06:31 +00:00
qgraphicsscene tests/auto/widgets: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b). 2015-07-31 11:50:10 +00:00
qgraphicssceneindex Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicstransform Update copyright headers 2015-02-11 06:49:51 +00:00
qgraphicsview Avoid missing paints when resizing GV with QOpenGLWidget viewport 2016-05-24 19:16:46 +00:00
qgraphicswidget Autotest: Enable make check on rhel 7.1 2016-02-11 05:47:38 +00:00
graphicsview.pro Re-enable tests tst_qgraphicsproxywidget, tst_qgraphicswidget. 2013-07-24 22:16:58 +02:00