From 686c44a69b13f6e884dd2b6d9991f4cd94597c5a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Sep 2016 10:49:57 +0200 Subject: Plug remaining leaks in tests/auto/widgets/kernel The usual: - delete return values of QLayout::takeAt(), replaceWidget() - delete styles - delete top-level widgets - delete actions Either by naked delete, QScopedPointer or allocation on the stack instead of the heap. This fixes the remaining errors in GCC 6.1 Linux ASan runs of tests/auto/widgets/kernel. Change-Id: I8cc217be114b2e0edf34ad8d60dbf722f900bb7f Reviewed-by: Thiago Macieira --- tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto/widgets/kernel/qaction') diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 71b55d71ea..b496550f85 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -329,7 +329,7 @@ void tst_QAction::enabledVisibleInteraction() void tst_QAction::task200823_tooltip() { - QAction *action = new QAction("foo", 0); + const QScopedPointer action(new QAction("foo", Q_NULLPTR)); QString shortcut("ctrl+o"); action->setShortcut(shortcut); @@ -343,8 +343,8 @@ void tst_QAction::task200823_tooltip() void tst_QAction::task229128TriggeredSignalWithoutActiongroup() { // test without a group - QAction *actionWithoutGroup = new QAction("Test", qApp); - QSignalSpy spyWithoutGroup(actionWithoutGroup, SIGNAL(triggered(bool))); + const QScopedPointer actionWithoutGroup(new QAction("Test", Q_NULLPTR)); + QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), SIGNAL(triggered(bool))); QCOMPARE(spyWithoutGroup.count(), 0); actionWithoutGroup->trigger(); // signal should be emitted -- cgit v1.2.3