SetContextProperty of model results in segmentation fault



  • Hi,

    I have implemented a listview in QML for which the model is implemented in Cpp.

    In order to refresh the model, as per QT instruction I have used the setContextProperty function call.
    context->setContextProperty(<modelName> , QVariant::fromValue(QList<QObject*>)).

    After completion of an operation issued by user on clicking a button, the listview is refreshed with the latest updates.

    The model gets refreshed continuously without any issue for 4 or 5 times, after which the execution results in segmentation fault.

    The exception that is thrown is as shown below:
    Unhandled exception at 0x6BB04E2F (Qt5Cored.dll) in <file.exe>: 0xC0000005: Access violation reading location 0x00000000.

    I understand that it is due to segmentation fault. Though how can the setContextProperty function be debugged to root cause the issue.
    Please provide your ideas.

    Thanks.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Your setContextProperty call looks a bit strange. You seem to want to pass an instance of QList<QObject *> but its' not really clear.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.