tst_QSplitter: fix compiler warning

QLabel *l is declared uninitialized, assigned in a for loop. The last
object is deleted for testing purposes.
This leads to a false compiler warning about deleting a potentially
unintialized pointer.

=> initialize with nullptr to silence the warning.

Change-Id: I1422b04fc1fdbfc7248de577884aabfb539f3f4b
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 41c8d215f273c048d76c51de4c56cb55c4325c85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Axel Spoerl 2023-08-30 10:20:34 +02:00 committed by Qt Cherry-pick Bot
parent 0ef069956f
commit 9954eb9c50

View File

@ -1032,7 +1032,7 @@ void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget()
QFETCH(bool, testingHide);
MyFriendlySplitter s;
QLabel *l;
QLabel *l = nullptr;
for (int i = 0; i < 5; ++i) {
l = new QLabel(QString("Label ") + QChar('A' + i));
l->setAlignment(Qt::AlignCenter);