DropShadow in Qml application causes Debug error. Reproducable 100%



  • Several days ago I got a "Debug error!" message box while running a QtQuick application, and the following message in Application output:

    ASSERT failure in QVector<T>::at: "index out of range", file c:\work\build\qt5_workdir\w\s\qtbase\include\qtcore../../src/corelib/tools/qvector.h, line 393

    It took a couple of hours to find out, that it is a DropShadow graphic effect, that cause this issue.

    Here is my "minimal application" (only qml files) that reproduces this case. This is a Qt Quick Application project.

    main.qml:

    import QtQuick 2.3
    import QtQuick.Window 2.2
    
    Window {
        id: root
        visible: true
    
        property int count: 0
    
        Text {
            id: text
            text: qsTr("loop count: ") + count
            anchors.horizontalCenter: parent
            anchors.top: parent.top
            anchors.topMargin: 10
        }
        Loader {
            id: loader
            anchors.top: text.bottom
            width: root.width
            height: root.height - text.height - 10
            source: "qrc:/one.qml"
        }
    
        Connections {
            target: loader.item
            onOne:{
                loader.source = "qrc:/two.qml"
            }
            onTwo: {
                loader.source = "qrc:/one.qml"
                count++
            }
        }
    }
    

    one.qml:

    import QtQuick 2.0
    import QtGraphicalEffects 1.0
    
    Item {
        id: root
        signal one ()
    
        Timer {
            interval: 1000; running: true; repeat: false
            onTriggered: root.one()
        }
    
        Rectangle {
            id: rect
            width: 100
            height: 100
            anchors.centerIn: root
            color: "red"
            border.color: "black"
            border.width: 3
            radius: 10
        }
        DropShadow {
             anchors.fill: rect
             horizontalOffset: 3
             verticalOffset: 3
             samples: 7
             color: "#80000000"
             source: rect
         }
    }
    

    The two.qml file is the same as the one.qml, it differs only in three lines:

    signal one () -> signal two ()
    onTriggered: root.one() -> onTriggered: root.two ()
    color: "red" -> color: "green"

    I get error messages short after start.
    You can experiment, commenting out DropShadow in one.qml, in two.qml, in both. If you comment out both, the application runs infinite.

    My environment:

    Qt Creator 3.6.0
    Based on Qt 5.5.1 (MSVC 2013, 32 bit)
    Built on Dec 15 2015 01:01:38
    From revision b52c2f91f5

    Kit: Desktop Qt 5.5.1 MSVC2010 32 bit

    Maybe someone knows what is happening there, and how can I use DropShadow without this errors?
    Thank you in advance!


  • Lifetime Qt Champion

    Hi,

    You should check against a more recent version of Qt to see if it's still reproducible (5.6.1 or 5.7.0). If so then you should take a look a the bug report system to see if it something known. If not please consider opening a new report providing your sample application.



  • @SGaist

    Thank you for your advice.
    Have changed to 5.7.0/MS VS 2015, no "Debug error!" enymore. But now it looks the same as if there were no DropShadow at all. I can not see any shadow.


  • Lifetime Qt Champion

    You may have found a bug then. You should check the bug report system to see if it's something known. If not please consider opening a new report with your sample application.


Log in to reply
 

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