tst_QSplitter: don't leak the QSplitter from initTestCase()
Several test functions use a centrally-allocated QSplitter for their tests. This object was allocated in initTestCase(), but cleanTestCase(), while present, was empty, so nothing deleted the object again. Fix by deleting the object in cleanupTestCase(). Initialize the member variable to nullptr so that the delete is well-formed even if initTestCase() for some reason didn't run (or didn't run to completion). Amends the start of the public history, where this function read #if defined(QT3_SUPPORT) delete qApp->mainWidget(); #endif which was already leaking if QT3_SUPPORT wasn't defined. Pick-to: 6.8 6.5 5.15 Change-Id: I43e5d8921a9c097f252e11709f25bc622fc8fe15 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit fbaa37633580dcf6b8ec3cd4a0da8d85902de2ea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b9fd0b1272
commit
b15d1ee499
@ -75,7 +75,7 @@ private slots:
|
||||
private:
|
||||
void removeThirdWidget();
|
||||
void addThirdWidget();
|
||||
QSplitter *splitter;
|
||||
QSplitter *splitter = nullptr;
|
||||
QWidget *w1;
|
||||
QWidget *w2;
|
||||
QWidget *w3;
|
||||
@ -144,6 +144,7 @@ void tst_QSplitter::addThirdWidget()
|
||||
|
||||
void tst_QSplitter::cleanupTestCase()
|
||||
{
|
||||
delete splitter;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user