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. Crash when trying to add inline component in non-inline component
Forum Updated to NodeBB v4.3 + New Features

Crash when trying to add inline component in non-inline component

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 959 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.
  • D Offline
    D Offline
    digorydoo
    wrote on last edited by
    #1

    I think I've spotted a bug in QML. I have the following component:

    @
    import QtQuick 2.2
    Rectangle
    {
    id: root;
    default property alias contents: contentFrame.children;
    color: "#05f"; width: 100; height: 100;

    Rectangle
    {
        id: contentFrame;
        anchors
        {
            fill: parent;
            leftMargin: 10; topMargin: 10; rightMargin: 10; bottomMargin: 10;
        }
        color: "#888";
    }
    

    }
    @

    The above component is saved as Test1.qml in a resource file qml.qrc. Now I create another component Test2.qml that uses Test1:

    @
    import QtQuick 2.2

    Test1
    {
    id: root;

    Rectangle
    {
        id: contentFrame;
        anchors
        {
            // fill: root; // fails, because our parent is NOT root [A]
            fill: parent;  // this is NOT root, but Test1's default item!
            leftMargin: 10; topMargin: 10; rightMargin: 10; bottomMargin: 10;
        }
        color: "#0a0";
    }
    
    /* Component // CRASH if you uncomment this! [B]
    {
        id: separator;
        Rectangle
        {
            height: 1;
            color: "#fab";
        }
    } */
    

    }
    @

    I marked two lines in the code above: [A]: This is perfectly OK: As I changed the default property in Test1, the Rectangle's parent isn't root, but some other item in Test1 (contentFrame).

    [B]: This is weird and probably a bug! If you add the definition of some component inside a component whose default property has been changed, the app would immediately crash!

    Is this a known bug? I'm using Qt 5.3.0.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      digorydoo
      wrote on last edited by
      #2

      I just tested this with Qt 5.3.2, the problem persists, it would still crash.

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        Yes, It crashes. Here we are trying to extend the external component again. This could be leading to the issue. However it not should not crash. May qml compiler should fix this issue. I suggest you can file a bug on this.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0
        • D Offline
          D Offline
          digorydoo
          wrote on last edited by
          #4

          OK.
          https://bugreports.qt-project.org/browse/QTBUG-41486

          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