[SailfishDevel] QQmlComponent: Cannot create new component instance before completing the previous
Krisztian Olah
fasza2mobile at gmail.com
Thu Sep 11 23:37:09 UTC 2014
Hi all, I've just introduced a bug that could cause segfault. It is unknown
to me what conditions trigger the bug exactly. I'm clueless as to why it
happens, I would be greatful for any kind of help.
I attached the error in a txt file I got in console when it crashed.
Basically a lot of: "QQmlComponent: Cannot create new component instance
before completing the previous"
and underneath "speed: $SOMEDOUBLE" was the result of:
Component.onCompleted: {
console.log("**** speed: " +
(messageLabel.paintedWidth - self.width) )
}
in messageLabel. So for some reason it wanted to construct a whole bunch of
Labels until it ran out of stack memory.
When the code works as expected I still get this warning/error msg just not
as many and don't crash:
"QQmlComponent: Cannot create new component instance before completing the
previous"
Here is the code in question:
RunningText is in StopHeader which is in turn a headerItem of a
SilicaListView the bug occurs(given unknown conditions which are rare) when
pushing the Page containig this SilicaListView
for a greater context see: https://github.com/KrisztianOlah/london-sail/
//RunnungText.qml
Item {
id: self
property color backgroundColor: Theme.highlightColor
property double backgroundOpacity: 0.4
property color textColor: Theme.highlightDimmerColor
state: (messageLabel.text === "") ? "invisible" : "visible"
Connections {
target: arrivalsData
onCurrentStopMessagesChanged: {
messageLabel.text = arrivalsData.getCurrentStopMessages()
}
}
Rectangle {
id: shade
color: backgroundColor
opacity: backgroundOpacity
anchors.fill: parent
Label {
id: messageLabel
color: textColor
clip: true
text: arrivalsData.getCurrentStopMessages()
anchors.verticalCenter: parent.verticalCenter
onTextChanged: {
state = (messageLabel.text === "") ? "invisible" : "visible"
arrivalsData.refreshArrivalsModel()
}
}
NumberAnimation {
id: animation
target: messageLabel
from: parent.width
to: 0 - messageLabel.paintedWidth
//should have the same speed for any length text
duration: (messageLabel.paintedWidth + self.width) * 5
property: "x"
running: true
loops: Animation.Infinite
}
}
OpacityRampEffect {
sourceItem: shade
direction: OpacityRamp.RightToLeft
slope: 0.5
offset: 0.001
}
states: [
State {
name: "visible"
PropertyChanges {
target: self
height: 50
}
},
State {
name: "invisible"
PropertyChanges {
target: self
height: 0
}
}
]
}
//StopHeader.qml
Item {
id: self
property Stop currentStop: arrivalsData.getCurrentStop()
property string stopPointIndicator: currentStop.getStopPointIndicator()
property string direction: currentStop.getTowards()
property alias distance: distanceLabel.text
property string message: ""
property string stopCode: currentStop.getID()
property int type: currentStop.getType()
property string title: currentStop.getName()
property bool isFavorite: arrivalsData.isStopFavorite(stopCode)
property double headerOpacity: Theme.highlightBackgroundOpacity
Connections {
target: self.currentStop
onDataChanged: {
self.stopPointIndicator = currentStop.getStopPointIndicator()
self.direction = currentStop.getTowards()
self.distance = distanceLabel.text
self.stopCode = currentStop.getID()
self.type = currentStop.getType()
self.title = currentStop.getName()
self.isFavorite = arrivalsData.isStopFavorite(stopCode)
}
}
anchors {
left: parent.left
right: parent.right
}
height: pageHeader.height + stopHeader.height + messageBox.height
+ Theme.paddingMedium*4
Label {
id: pageHeader
text: title
font.pixelSize: Theme.fontSizeLarge
color: Theme.highlightColor
horizontalAlignment: Text.AlignRight
wrapMode: Text.WordWrap
anchors {
top: parent.top
topMargin: Theme.paddingMedium*2
right: parent.right
rightMargin: Theme.paddingLarge
left: parent.left
leftMargin: 130
}
}
RunningText {
id: messageBox
anchors {
top: pageHeader.bottom
topMargin: Theme.paddingMedium*2
left: parent.left
right: parent.right
}
}
Rectangle {
id: stopHeader
height: directionLabel.paintedHeight + Theme.paddingMedium*2
color: Theme.highlightBackgroundColor
opacity: headerOpacity
anchors {
top: messageBox.bottom
left: parent.left
right: parent.right
}
}
StopIcon {
id: icon
stopPointIndicator: self.stopPointIndicator
type: self.type
anchors {
verticalCenter: stopHeader.verticalCenter
left: stopHeader.left
leftMargin: Theme.paddingSmall
}
}
IconButton {
id: favoriteButton
icon.source: isFavorite ? "image://theme/icon-l-favorite" :
"image://theme/icon-l-star"
anchors {
right: stopHeader.right
verticalCenter: stopHeader.verticalCenter
}
onClicked: {
if (!isFavorite) {
self.currentStop.addToDb(true)//won't do anything if
record is already in db
arrivalsData.favorStop(stopCode, true)//make sure it
is favorite in case record was already in db
isFavorite = arrivalsData.isStopFavorite(stopCode)
}
else {
arrivalsData.favorStop(stopCode, false)
isFavorite = arrivalsData.isStopFavorite(stopCode)
}
}
}
Label {
id: towardsLabel
text: (directionLabel.text !== "" && (type === Stop.Bus ||
type === Stop.River)) ? "towards" : ""
font.pixelSize: Theme.fontSizeTiny
color: Theme.highlightColor
anchors {
left: icon.right
leftMargin: Theme.paddingExtraLarge
top: stopHeader.top
topMargin: Theme.paddingSmall
}
}
Label {
id: directionLabel
text: currentStop.getTowards()
color: Theme.highlightColor
wrapMode: Text.WordWrap
anchors {
top: stopHeader.top
topMargin: Theme.paddingMedium
bottom: stopHeader.bottom
bottomMargin: Theme.paddingMedium
left: towardsLabel.right
leftMargin: Theme.paddingSmall
right: favoriteButton.left
rightMargin: Theme.paddingLarge
}
}
Label {
id: distanceLabel
text: ""
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.highlightColor
anchors {
right: stopHeader.right
bottom: stopHeader.bottom
}
}
states: [
State {
name: "invisible"
PropertyChanges {
target: self
opacity: 0
}
PropertyChanges {
target: icon
opacity: 0
}
},
State {
name: "visible"
PropertyChanges {
target: self
opacity: 100
}
PropertyChanges {
target: icon
opacity: 100
}
}
]
transitions: [
Transition {
from: "invisible"
to: "visible"
FadeAnimation {
target: self
}
},
Transition {
from: "visible"
to: "invisible"
FadeAnimation {
target: self
}
}
]
onTitleChanged: { state = (title === "") ? "invisible" : "visible" }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140912/7b92d9db/attachment-0001.html>
-------------- next part --------------
[D] ArrivalsLogic::stopArrivalsUpdate:468 - updating stopped.
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
[W] unknown:72 - file:///usr/lib/qt5/qml/Sailfish/Silica/SearchField.qml:72: TypeError: Cannot read property 'activeFocus' of null
QSqlQuery::value: not positioned on a valid record
**** speed: -540
[W] unknown:51 - file:///opt/sdk/harbour-london-sail/usr/share/harbour-london-sail/qml/pages/BusStopPage.qml:51:5: QML Connections: Cannot assign to non-existent property "onDownloadSatateChanged"
**** speed: -960
[D] ArrivalsLogic::fetchArrivalsData:152 - updated
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
[D] ArrivalsLogic::stopArrivalsUpdate:468 - updating stopped.
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
**** speed: -540
[W] unknown:51 - file:///opt/sdk/harbour-london-sail/usr/share/harbour-london-sail/qml/pages/BusStopPage.qml:51:5: QML Connections: Cannot assign to non-existent property "onDownloadSatateChanged"
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 905.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 905.15625
[D] ArrivalsLogic::fetchArrivalsData:152 - updated
[D] ArrivalsLogic::stopArrivalsUpdate:468 - updating stopped.
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
**** speed: -540
[W] unknown:51 - file:///opt/sdk/harbour-london-sail/usr/share/harbour-london-sail/qml/pages/BusStopPage.qml:51:5: QML Connections: Cannot assign to non-existent property "onDownloadSatateChanged"
**** speed: -960
[D] ArrivalsLogic::fetchArrivalsData:152 - updated
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
[D] ArrivalsLogic::fetchArrivalsData:152 - updated
[D] ArrivalsLogic::stopArrivalsUpdate:468 - updating stopped.
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
QSqlQuery::value: not positioned on a valid record
**** speed: -540
[W] unknown:51 - file:///opt/sdk/harbour-london-sail/usr/share/harbour-london-sail/qml/pages/BusStopPage.qml:51:5: QML Connections: Cannot assign to non-existent property "onDownloadSatateChanged"
**** speed: -960
[D] ArrivalsLogic::fetchArrivalsData:152 - updated
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
[W] unknown:-1 - file:///usr/lib/qt5/qml/Sailfish/Silica/private/HighlightImage.qml: RangeError: Maximum call stack size exceeded
**** speed: 485.15625
QQmlComponent: Cannot create new component instance before completing the previous
Remote application crashed: Process killed by signal
More information about the Devel
mailing list