summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2021-07-06 14:08:28 +0200
committerAndreas Buhr <andreas.buhr@qt.io>2021-07-06 18:30:26 +0200
commitb854bf06dc1902b101c2622f519c84a2a93e2fb1 (patch)
tree6167fa87be9f5ecc064ae19c21721fe45ccb2e42 /tests/auto/widgets
parenteaa48136a39f153b05bb1842734bbe2277191510 (diff)
Fix memory leaks in tst_qlineedit
In the unit tests, two times a validator was used without a parent, which led to memory leaks. This patch changes this: The validators are initialized with the widget they are meant for as parent. This fixes the memory leaks. Pick-to: 6.2 Change-Id: I480c0c5104cbe60159fad49df28cbb6240e7ce68 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 8668dfb8e2..99344228b6 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3322,7 +3322,7 @@ void tst_QLineEdit::validateOnFocusOut()
QLineEdit *testWidget = ensureTestWidget();
QSignalSpy editingFinishedSpy(testWidget, SIGNAL(editingFinished()));
- testWidget->setValidator(new QIntValidator(100, 999, 0));
+ testWidget->setValidator(new QIntValidator(100, 999, testWidget));
QTest::keyPress(testWidget, '1');
QTest::keyPress(testWidget, '0');
QCOMPARE(testWidget->text(), QString("10"));
@@ -3347,7 +3347,7 @@ void tst_QLineEdit::editInvalidText()
{
QLineEdit *testWidget = ensureTestWidget();
testWidget->clear();
- testWidget->setValidator(new QIntValidator(0, 12, 0));
+ testWidget->setValidator(new QIntValidator(0, 12, testWidget));
testWidget->setText("1234");
QVERIFY(!testWidget->hasAcceptableInput());