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

NinePatchImage crashed when source changed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.13.1
    • Fix Version/s: 5.13.2, 5.14.0 RC1
    • Component/s: Quick: Controls 2
    • Labels:
      None
    • Environment:
      OS: Ubuntu 16.04
    • Platform/s:
      Linux/X11
    • Commits:
      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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes