property alias causes crash in 5.9.1



  • When calling createObject() on the component with property alias, crash happens.
    0_1505287892481_QQ图片20170913153102.png

    The code snipet is as follows.
    [main.qml]
    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    Item {
        id: root
        anchors.fill: parent
    
        Foo {
            id: foo
        }
    
        Timer {
            id: timer
    
            running: true
            repeat: true
            interval: 1000
    
            onTriggered: {
                foo.createObject(root, {"foo": 0.5, "foo2": 2, "foo3": true})
            }
        }
    }
    

    }

    [Foo.qml]
    Component {
    Item {
    property alias foo: bar.opacity
    property alias foo2: bar.scale
    property alias foo3: bar.visible

        id: foo
    
        x: 100
        y: 100
        width: 100
        height: 100
    
        Rectangle {
            id: bar
            anchors.fill: parent
            color: "green"
        }
    }
    

    }



  • Failed to attach screenshot.

    The assert dialog shows
    "properties.count == propertyIndexCache.count()" in file qml\qqmlpropertycache.cpp, line 1188.



  • @Surka Hi. Property alias and the Item id has the same name foo - it can't be the same. I also don't think that Rectangle has property scale.



  • @m-kuncevicius Yes, that's my typo. But it is irrelavant to the crash. The issue here is Qt reporting its internal assertion. btw, scale is property of Item.


Log in to reply
 

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