tst_QGraphicsProxyWidget: fix memleak in forwardTouchEvent()
The result of QTest::createTouchDevice() needs to be deleted by the caller. The test function didn't, so leaked the object. Fix by holding it in unique_ptr. Amends 982b70d37db337b2c57a3cfce0f24c3d00a598d6, even though the code that this patch replaced looked leaky, too. Pick-to: 6.9 6.8 6.5 5.15 Change-Id: I3c7dfab31dc6ab364195381352d98fbd9c730990 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
01ee8fd7b5
commit
bfd852c502
@ -3816,17 +3816,17 @@ void tst_QGraphicsProxyWidget::forwardTouchEvent()
|
||||
|
||||
EventSpy eventSpy(widget);
|
||||
|
||||
QPointingDevice *device = QTest::createTouchDevice();
|
||||
const std::unique_ptr<QPointingDevice> device{QTest::createTouchDevice()};
|
||||
|
||||
QVERIFY(device);
|
||||
QCOMPARE(eventSpy.counts[QEvent::TouchBegin], 0);
|
||||
QCOMPARE(eventSpy.counts[QEvent::TouchUpdate], 0);
|
||||
QCOMPARE(eventSpy.counts[QEvent::TouchEnd], 0);
|
||||
|
||||
QTest::touchEvent(&view, device).press(0, QPoint(10, 10), &view);
|
||||
QTest::touchEvent(&view, device).move(0, QPoint(15, 15), &view);
|
||||
QTest::touchEvent(&view, device).move(0, QPoint(16, 16), &view);
|
||||
QTest::touchEvent(&view, device).release(0, QPoint(15, 15), &view);
|
||||
QTest::touchEvent(&view, device.get()).press(0, QPoint(10, 10), &view);
|
||||
QTest::touchEvent(&view, device.get()).move(0, QPoint(15, 15), &view);
|
||||
QTest::touchEvent(&view, device.get()).move(0, QPoint(16, 16), &view);
|
||||
QTest::touchEvent(&view, device.get()).release(0, QPoint(15, 15), &view);
|
||||
|
||||
QApplication::processEvents();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user