Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.7.4
-
None
-
Mac OS X 10.6
-
6a01c81dffe3122138bb9708166c1701059f01fa, 93c64e1be3a2d68eb504d7c4f7c60f66ce1ff650
Description
The following code cause a crash, when entering both states, state1 and state2, and deleting the DeclarativeView (by closing the QMLViewer).
import QtQuick 1.0 Rectangle { id: backgroundId width: 360 height: 360 Rectangle { id: rectangle1 color: "#AAAAAA" width: childrenRect.width + 10 height: childrenRect.height + 10 radius: 5 anchors.centerIn: parent Text { id: directionText text: "Left click for state1 and\nRight click for state2"; anchors.centerIn: parent } } Text { id: stateText anchors.top: directionText.bottom anchors.horizontalCenter: directionText.horizontalCenter text: "Default State" } MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true //Enable mouse tracking acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: { if(mouse.button == Qt.LeftButton) { state = "State1" } else if(mouse.button == Qt.RightButton) { state = "State2" } } onPositionChanged: { console.log("Default state: " + mouse.x + " " + mouse.y) } states: [ State { name: "State1" PropertyChanges { target: mouseArea onPositionChanged: { console.log("State1: " + mouse.x + " " + mouse.y) } onReleased: { state = "" //Return to the default state } } PropertyChanges { target: stateText text: "State1" } }, State { name: "State2" PropertyChanges { target: mouseArea onPositionChanged: { console.log("State2: " + mouse.x + " " + mouse.y) } onReleased: { state = "" //Return to the default state } } PropertyChanges { target: stateText text: "State2" } } ] } }
The application doesn't crash when moving the states: [ ] from mouseArea to the mouseArea's parent, backgroundId.
It won't crash when entering only one of the two states.
Attachments
For Gerrit Dashboard: QTBUG-21617 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
8442,1 | Fix crash on exit when overriding signal handlers in states. | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |