ShadowedTexture: Fix crash in cases where QSGTextureProvider::textureChanged signal-functor connection outlives the life of the functor.
The crash is easily reproducible if there is a binding which causes textureChanged signal to be emitted.
To reproduce the crash the implementation:
import QtQuick 2.15
import org.kde.kirigami 2.12 as Kirigami
GridView {
id: root
width: 5
height: 5
delegate: Kirigami.Card {
banner {
source: model.source
sourceSize {
width: root.width
height: root.height
}
}
}
// ignore
model: ListModel {
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
ListElement {source: "/tmp/path.svg"}
}
}
where you have to wget
https://svgwg.org/svg2-draft/images/paths/triangle01.svg to /tmp/path.svg and after that resize the window. On my system here's the output with some debug logs to give an idea:
[CREATED] object: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 0 y2= 0 )
lambda called on: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 19 y2= 19 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 19 y2= 19 materialtype= 0x7f05a83f8273 )
[CREATED] object: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f0568031ec0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f0568036d70 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f0568010910 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680dca30 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680dd280 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680dd750 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680ddc00 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680de0b0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680de560 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680dea10 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680deec0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
[CREATED] object: GeometryNode( 0x7f05680df370 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 )
lambda called on: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680df370 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
file:///tmp/main.qml:10:15: QML Card: Binding loop detected for property "implicitHeight"
lambda called on: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f0568031ec0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f0568031ec0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f0568036d70 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f0568036d70 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f0568010910 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f0568010910 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680dca30 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680dca30 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680dd280 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680dd280 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680dd750 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680dd750 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680ddc00 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680ddc00 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680de0b0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680de0b0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680de560 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680de560 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680dea10 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680dea10 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680deec0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
[DESTORYED] object: GeometryNode( 0x7f05680deec0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 2574 y2= 1402.63 materialtype= 0x7f05a83f8273 )
lambda called on: GeometryNode( 0x7f05680102e0 strip #V: 4 #I: 0 x1= 0 y1= 0 x2= 1292 y2= 1410.28 materialtype= 0x7f05a83f8272 )
[1] 621903 segmentation fault (core dumped) qmlscene main.qml
Look at the last address 0x7f05680102e0
and see it is used within the lambda even after it is destroyed.