tst_QGraphicsWidget: fix memleak in setStyle()
The result of QStyleFactory::create() is owned by the caller, and this test function neglected to delete it, leaking the object. To fix, reset() it, once created, into a unique_ptr. This is the minimally0-invasive fix. Amends 9bc49b0bca361646aac90cd00706588d3dcd66c9. Pick-to: 6.8 6.5 5.15 Change-Id: I17fae174b93bd27e2cac6e5e2d2c8a4ac2de703e Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit f0a9b5b6f11dc5deaabadce0ee672530683cf0a0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
08986f17f6
commit
604a76c8b3
@ -1356,9 +1356,12 @@ void tst_QGraphicsWidget::setStyle()
|
||||
|
||||
int oldEventCounts = widget.eventCount;
|
||||
|
||||
std::unique_ptr<QStyle> reaper;
|
||||
|
||||
QFETCH(QString, style);
|
||||
if (!style.isEmpty()) {
|
||||
QStyle *fstyle = QStyleFactory::create(style);
|
||||
reaper.reset(fstyle);
|
||||
widget.setStyle(fstyle);
|
||||
QCOMPARE(widget.style(), fstyle);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user