From 106bef0493758ddaeadd3b4d744227cb7feadb70 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 3 Mar 2021 11:38:26 +0100 Subject: QSurfaceDataProxy: Fix crashes adding the first row of data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding one row causes an assert ASSERT failure in QList::at: "index out of range", file include/QtCore/qlist.h, line 373 since there is no first row to check the column count against. Check for empty as well. Pick-to: 5.15 6.1 Task-number: PYSIDE-1438 Change-Id: I225b87b764545b7a430472dc5a4b2e476a26a7ff Reviewed-by: Tomi Korpipää --- tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp b/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp index 7c793910..16025964 100644 --- a/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp +++ b/tests/auto/cpptest/q3dsurface-proxy/tst_proxy.cpp @@ -45,6 +45,7 @@ private slots: void initialProperties(); void initializeProperties(); + void initialRow(); private: QSurfaceDataProxy *m_proxy; @@ -103,5 +104,14 @@ void tst_proxy::initializeProperties() QCOMPARE(m_proxy->rowCount(), 2); } +void tst_proxy::initialRow() +{ + QSurfaceDataProxy proxy; + QSurfaceDataRow row{QSurfaceDataItem{QVector3D{0, 0, 0}}, + QSurfaceDataItem{QVector3D{1, 1, 1}}}; + proxy.addRow(new QSurfaceDataRow(row)); + proxy.addRow(new QSurfaceDataRow(row)); +} + QTEST_MAIN(tst_proxy) #include "tst_proxy.moc" -- cgit v1.2.3