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

Qt destroy my c++ listModel into the QML side, when passing by a Q_INVOKABLE list* function()

    XMLWordPrintable

Details

    Description

      I use a c++ listModel (derived from QAbstractListModel) which contains items with sub listModel.
      The main list is passed to the Quick view by 'setContextProperty()', but the sub-lists are passed by a Q_INVOKABLE list* function().
      Into QML side, I use Repeaters to show my items.
      The loading works fine, but, I don't know why, when I use my application, suddenly, my listModel is destroyed by an unknown event and the application crashes.
      Nevertheless, all works fine if I give my sublist by 'setContextProperty()'.

      My subList is a dynamic member of the parent item. If I use a static member, the application crashes also, but I get this message:

      *** Error in `/home/thierry/Développement/build-TilesViewer-Desktop_Qt_5_3_0_GCC_64bit-Debug/TilesViewer': double free or corruption (out): 0x00000000012a9850 ***
      ======= Backtrace: =========
      /lib64/libc.so.6(+0x7b1d6)[0x7fb4ba46b1d6]
      /home/thierry/Développement/build-TilesViewer-Desktop_Qt_5_3_0_GCC_64bit-Debug/TilesViewer[0x409816]
      /home/thierry/Qt5.3.0/5.3/gcc_64/lib/libQt5Core.so.5(_ZN7QObject5eventEP6QEvent+0x438)[0x7fb4bb806478]
      /home/thierry/Qt5.3.0/5.3/gcc_64/lib/libQt5Core.so.5(_ZN16QCoreApplication6notifyEP7QObjectP6QEvent+0x3d)[0x7fb4bb7d2dfd]
      /home/thierry/Qt5.3.0/5.3/gcc_64/lib/libQt5Core.so.5(_ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent+0x84)[0x7fb4bb7d2aa4]
      /home/thierry/Qt5.3.0/5.3/gcc_64/lib/libQt5Core.so.5(_ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData+0x258)[0x7fb4bb7d5628]
      /home/thierry/Qt5.3.0/5.3/gcc_64/lib/libQt5Core.so.5(+0x328c33)[0x7fb4bb82cc33]
      /lib64/libglib-2.0.so.0(g_main_context_dispatch+0x135)[0x7fb4b938b6d5]
      /lib64/libglib-2.0.so.0(+0x47a08)[0x7fb4b938ba08]
      /lib64/libglib-2.0.so.0(g_main_context_iteration+0x34)[0x7fb4b938bac4]
      ...
      

      (the whole message is in crash.txt)

      You can try my application. I write a map. You can drag the view with the mouse or zoom with the wheel.
      If you use the line 48 of TilesView.qml, all is OK. But if you use the line 47, the application crash when you drag the view or if you zoom out 9 times.
      (If the view is empty, the path of the map is set at the line 79 of map.cpp)

      Attachments

        1. crash.txt
          38 kB
        2. MapViewer.tar.gz
          7.35 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            vtitux Thierry Vetter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes