tst_QComboBox: fix memleak in task190205_setModelAdjustToContents()
A QComboBox does not own the model set on it, because models can be in many views at once. So the QStringListModel, allocated on the heap without a QObject parent was leaked. Fix by giving the model the combo-box as QObject parent. Amends the start of the public history. Pick-to: 6.8 6.5 5.15 Change-Id: Idd9057c8f796937d9d3c5c4ef99b329124d2192d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit c41592c900257177849758ef31212a83fc813be5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c818392a59
commit
73d2a7d29b
@ -2471,7 +2471,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents()
|
||||
//wait needed in order to get the combo initial size
|
||||
QTRY_VERIFY(box.isVisible());
|
||||
|
||||
box.setModel(new QStringListModel(finalContent));
|
||||
box.setModel(new QStringListModel(finalContent, &box));
|
||||
|
||||
QComboBox correctBox;
|
||||
setFrameless(&correctBox);
|
||||
|
Loading…
x
Reference in New Issue
Block a user