mobile: the infamous enumerate problem

This fix seems to fix the enumerate problem: the problem that on a
seemingly non-determinstic way, all the profiles get enumerated
and rendered, causing freeze of the app, or even crash due
to out of memory.

Only 3 lines of code change, but this fix did not come easy. The
enumerate problem seems some kind of race condition between QML,
Kiragami and most definitely, the Subsurface QML code itself.
The breakthrough in my debugging was the setting of
highlightRangeMode: ListView.StrictlyEnforceRange based on
the QML documentation on snapMode: enumeration.

This fix deserves proper testing in multiple environments. As
could be seen on the developpers mailing list, I was (easily)
able to reproduce the enumerate problem, but Rick was not. So
I definitely do not claim to understand why this fix solves
the issue for me.

And as a sidenote: fixes #263 for me as well.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-03-24 10:14:56 +01:00 committed by Dirk Hohndel
parent ed3f5a6240
commit 59417342c7

View file

@ -171,7 +171,7 @@ Kirigami.Page {
diveDetailsPage.state = "edit"
}
onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning);
//onWidthChanged: diveDetailsListView.positionViewAtIndex(diveDetailsListView.currentIndex, ListView.Beginning);
Item {
anchors.fill: parent
@ -189,8 +189,9 @@ Kirigami.Page {
highlightFollowsCurrentItem: true
focus: true
clip: false
cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels)
//cacheBuffer: parent.width * 3 // cache one item on either side (this is in pixels)
snapMode: ListView.SnapOneItem
highlightRangeMode: ListView.StrictlyEnforceRange
onMovementEnded: {
currentIndex = indexAt(contentX+1, 1);
}