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

NinePatchImage crashed when source changed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.13.2, 5.14.0 RC1
    • 5.13.1
    • Quick: Controls 2
    • None
    • OS: Ubuntu 16.04
    • Linux/X11
    • 788865b805bc91151ac8fe18bf7b92b1212ee07d (qt/qtquickcontrols2/5.13)

    Description

      This is a basic case of changing the source property of NinePatchImage.

      It is managed using states.

      The scenario is that after pressing the button, its state need to be changed to "focus" to display focusing resource.

      It causes the crash with 100% reproducible with the following code:

      File: main.qml

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Controls 2.5
      import QtQuick.Controls.Imagine 2.12
      import QtQuick.Controls.Imagine.impl 2.12
      
      Window {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")    
      
          NinePatchImage {
              id: idNinePatchesImage
              anchors.centerIn: parent
              width: 300
              height: 300
              state: "normal"
              states: [
                  State {
                      name: "press"
                      PropertyChanges {
                          target: idNinePatchesImage
                          // 9-patches
                          source: "qrc:/button-background.9.png"
                      }
                  },
                  State {
                      name: "focus"
                      PropertyChanges {
                          target: idNinePatchesImage
                          // normal image
                          source: "qrc:/roundbutton-background-pressed.png"
                      }
                  },
                  State {
                      name: "normal"
                      PropertyChanges {
                          target: idNinePatchesImage
                          // normal image
                          source: "qrc:/dial-background.png"
                      }
                  }
              ]
              onSourceChanged: {
                  console.log("source: " + source)
              }
              onProgressChanged: {
                  console.log("progress: " + progress)
              }
          }
          MouseArea {
              anchors.fill: parent
              onPressed: {
                  idNinePatchesImage.state = "press"
              }        
              onReleased: {
                  idNinePatchesImage.state = "normal"
              }
              onClicked: {
                  idNinePatchesImage.state = "focus"
              }
          }
      }
      
      

      Attachments

        Activity

          People

            mitch_curtis Mitch Curtis
            hoant Hoa Nguyen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: