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. Bug? Appending two items to a QML ListModel, then model.move(1,0,1); causes crash.
QtWS25 Last Chance

Bug? Appending two items to a QML ListModel, then model.move(1,0,1); causes crash.

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.0k Views
  • 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.
  • S Offline
    S Offline
    spazvt
    wrote on last edited by
    #1

    I think the code snippet below is enough to demonstrate the bug I think I've found. If I have a ListModel in QML and I insert() two items at the beginning of the list, then move the second item to the beginning of the list, it works correctly. However, when I have an empty list and add two items to the list using the append() command instead, then use the move(1,0,1) command to move the second element to the top of the list, it crashes.

    @ ListModel {
    id: alertModel
    }

    Component.onCompleted: {
    
        var data1 = {
            'alertDescription' : "Alert #1",
            'alertType' : 2,
            'acknowledged' : false,
            'alertState' : "yellow",
            'alertId' : 0
        };
        var data2 = {
            'alertDescription' : "Alert #2",
            'alertType' : 3,
            'acknowledged' : false,
            'alertState' : "red",
            'alertId' : 1
        };
    

    // alertModel.insert(0, data1);
    // alertModel.insert(0, data2);
    alertModel.append(data1);
    alertModel.append(data2);
    alertModel.move(1,0,1);
    }@

    The specific command-line crash info is as follows:
    "ASSERT: "!isEmpty()" in file ../../include/QtCore/../../src/corelib/tools/qlist.h, line 282" a few lines down it says "LEAK: 231 Structure".

    I'm using Qt code 4.7.4, with the latest 4.7 updates. I know it's not 4.8.1, but I'm choosing not to use that version because it crashes when qmlviewer.exe can't find an exported C++ library, rather than gracefully refusing.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chriadam
      wrote on last edited by
      #2

      Please file a bug report for this issue with a complete backtrace and your repro.
      Also, please file a bug report about the plugin loading crash, since that sounds suspect.

      Cheers,
      Chris.

      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