Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44266

TableView crashes on iOS and Android when using Instantiator for TableViewColumns

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • None
    • 5.4.0, 5.4.2
    • None
    • Qt 5.4 on iPhone 4S (iOS 7.1) and iPhone 6+ (iOS 8.1.3)
    • iOS/tvOS/watchOS

    Description

      When dynamically creating TableViewColumn elements using an Instantiator, the application crashes on iOS and Android.

      Run the following qml file on an iOS or Android device:

      import QtQuick 2.4
      import QtQuick.Controls 1.3
      
      Item {
          id: root
      
          readonly property var datasets: [
              {0: "Test", 1: "Another", 2: "Column"},
              {0: "Test", 1: "Another", 2: "Column"},
              {0: "Test", 1: "Another", 2: "Column"},
              {0: "Test", 1: "Another", 2: "Column"},
              {0: "Test", 1: "Another", 2: "Column"}
          ]
      
          TableView {
              id: table
              anchors.fill: parent
      
              Instantiator {
                  model: Object.keys(root.datasets[0]).length
                  delegate: TableViewColumn {
                      role: index
                      title: "Column " + (index + 1)
                  }
                  onObjectAdded: table.addColumn(object)
                  onObjectRemoved: table.removeColumn(index)
              }
      
              model: root.datasets
          }
      }
      

      If you remove the onObjectAdded: table.addColumn(object) line, the table is empty, of course, but no longer crashes. Also creating TableViewColumn items outside and adding them in, say, Component.onCompleted works fine. It's just through the Instantiator that it crashes, it runs fine on a Linux desktop machine.

      0	__pthread_kill	__pthread_kill		0x3aba31f0	
      1	pthread_kill	pthread_kill		0x3ac0d796	
      2	abort	abort		0x3ab53fdc	
      3	qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&)	qlogging.cpp	1414	0xbb403c	
      4	QMessageLogger::fatal(char const*, ...) const	qlogging.cpp	639	0xbb4690	
      5	qt_assert(char const*, char const*, int)	qglobal.cpp	2810	0xbafa12	
      6	qAllocMore(int, int)	qbytearray.cpp	65	0xbc8194	
      7	QArrayData::allocate(unsigned long, unsigned long, unsigned long, QFlags<QArrayData::AllocationOption>)	qarraydata.cpp	89	0xbc775e	
      8	QTypedArrayData<QPointer<QQuickItem>>::allocate(unsigned long, QFlags<QArrayData::AllocationOption>)	qarraydata.h	215	0x5623b2	
      9	QVector<QPointer<QQuickItem>>::reallocData(int, int, QFlags<QArrayData::AllocationOption>)	qvector.h	499	0x561eca	
      10	QVector<QPointer<QQuickItem>>::resize(int)	qvector.h	381	0x5615d4	
      11	QQuickRepeater::regenerate()	qquickrepeater.cpp	378	0x560926	
      12	QQuickRepeater::componentComplete()	qquickrepeater.cpp	334	0x560b5e	
      13	non-virtual thunk to QQuickRepeater::componentComplete()	qquickrepeater.cpp	337	0x560ba4	
      14	QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&)	qqmlobjectcreator.cpp	1228	0xaa8c9e	
      15	QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*)	qqmlcomponent.cpp	928	0xa386a2	
      16	QQmlComponentPrivate::completeCreate()	qqmlcomponent.cpp	964	0xa37672	
      17	QQmlComponent::completeCreate()	qqmlcomponent.cpp	957	0xa3870a	
      18	QQmlComponent::create(QQmlContext*)	qqmlcomponent.cpp	791	0xa3808e	
      19	QQuickView::continueExecute()	qquickview.cpp	480	0x57d284	
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              broulik Kai Uwe Broulik
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes