diff options
author | Marc Mutz <[email protected]> | 2025-03-31 21:27:43 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2025-04-02 16:37:40 +0200 |
commit | 27279e01d2794bba8c69db4b987c3351a2daa619 (patch) | |
tree | 59b7cf501f97afe0e1167459140580d7ed642266 | |
parent | c41592c900257177849758ef31212a83fc813be5 (diff) |
tst_QComboBox: fix memleaks in task_QTBUG_52027_mapCompleterIndex()
Both the QCompleter and the QSortFilterProxy objects are not owned by
the QComboBox merely by setting them as completer and model. Having no
other QObject parents, and having being allocated on the heap, they
were leaked.
To fix, give them the combo-box as QObject parent.
Amends 8b6d6d4832ea8ed5f9857d5ddf06408ee9d0b4e0.
Pick-to: 6.9 6.8 6.5 5.15
Change-Id: I5c3594272a5283a3fbaeb9885d315047b04f30de
Reviewed-by: Volker Hilsheimer <[email protected]>
-rw-r--r-- | tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index eeaacc7794d..91c0d10b7cf 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -3582,7 +3582,7 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex() cbox.setInsertPolicy(QComboBox::NoInsert); cbox.addItems(words); - QCompleter *completer = new QCompleter(altWords); + QCompleter *completer = new QCompleter(altWords, &cbox); completer->setCaseSensitivity(Qt::CaseInsensitive); cbox.setCompleter(completer); @@ -3605,7 +3605,7 @@ void tst_QComboBox::task_QTBUG_52027_mapCompleterIndex() cbox.lineEdit()->selectAll(); cbox.lineEdit()->del(); - QSortFilterProxyModel* model = new QSortFilterProxyModel(); + QSortFilterProxyModel* model = new QSortFilterProxyModel(&cbox); model->setSourceModel(cbox.model()); model->setFilterFixedString("foobar1"); completer->setModel(model); |