[Qt-qml] ListView crashes with more than 256 delegate elements.

martin.jones at nokia.com martin.jones at nokia.com
Tue Jan 4 08:47:53 CET 2011


This is related to http://bugreports.qt.nokia.com/browse/QTBUG-16039, but it would be good if you could create a new bug report with an example which reproduces your use case.

Br,
Martin.

> -----Original Message-----
> From: qt-qml-bounces+martin.jones=nokia.com at qt.nokia.com [mailto:qt-qml-
> bounces+martin.jones=nokia.com at qt.nokia.com] On Behalf Of ext Yuvraaj Kelkar
> Sent: Tuesday, 4 January 2011 2:36 AM
> To: qt-qml at qt.nokia.com
> Subject: Re: [Qt-qml] ListView crashes with more than 256 delegate elements.
> 
> Posting the solution to fix this problem:
> 
> > I have a QML List View here:
> >
> http://code.google.com/p/qgvdial/source/browse/branches/contactsui/qml/Contacts
> List.qml?r=285
> > This list shows contacts from a model which I derive from QSqlQueryModel.
> > There are about 800 contacts in the table.
> >
> > When I scroll down the contacts list, at the point where QML is
> > loading the 256th delegate, it spews the output:
> > "
> > QDeclarativeComponent: Cannot create new component instance before
> > completing the previous
> > <Unknown File>: QML VisualDataModel: Error creating delgate
> > qrc:/ContactsList.qml:105:13: QML Text: Binding loop detected for
> > property "text"
> > qrc:/ContactsList.qml:95:32767: QML Component: Delegate component must
> > be Item type.
> > "
> >
> > And then it segfaults.
> >
> > If I use qmlviewer with a test ListModel with >1000 contacts, it
> > works, but my code does not.
> > I think this may be a QML bug, but I am not sure.
> > Any help is appreciated.
> 
> The solution is to add
> while (model->canFetchMore()) { model->fetchMore(); }
> after telling the QML view about the model.
> 
> The QML ListView was attempting to access the next cached model index.
> Since only the first 256 entries had been indexed, the 257th attempt
> consistently segfaulted.
> With the canFetch,fetchMore loop, the cache is entirely populated and
> all is well.
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml


More information about the Qt-qml mailing list