Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SetContextProperty of model results in segmentation fault

SetContextProperty of model results in segmentation fault

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 675 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kirthivasan
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved