Hi Dmitriy, Thank you for your input!
I am building a todo list app which have projects and tasks stored in sql. These projects/tasks shall be displayed in several ListViews (on different Pages). I have mainly two use cases for displaying the sql data: 1) A full screen ListView inside a Flickable. I use "anchors.fill: parent" to set the size for this ListView. 2) A ListView which does not cover the entire Page since I want some other QML items on that page. I use a QML Column to display the QML items including the ListView, but I have set the ListView to a fixed size to get the right proportions between the different items in the QML Column. I have however been able to reproduce the problem for both cases above so I don't think the problem is related to the ListView having a fixed height. My app use Silica components like SilicaFlickable and SIlicaListView but when troubleshooting I have tried to remove the Silica components to rule out any Silica related bugs. I could however not find any matching components to replace Silica ListItem and ContextMenu so I cannot completely rule out that this bug may be related to Silica components. >From the call stack it looks like it crashes in Qt core components, but I have >problems following what happens. It is #89 in the call stack which deletes the >item in the model/ListView which eventually results in segmentation fault. Regards On Mon, 7 Sep 2015 09:42:19 +0600, Dmitriy Purgin <dpur...@gmail.com> wrote: > Hi, > > can you tell please what are you trying to achieve, e.g. what view are you > building? Why do you set explicit height for the ListView anyway? > > Cheers > Dmitriy > > 2015-09-06 14:00 GMT+06:00 coding <cod...@userspace.se>: > > > Hi, > > > > I am developing a sailfish app using a QML ListView which is connected to > > a model using a sqlite db. The model is based on QSqlTableModel, but > > extended so it can be used by the QML ListView. I have found a segmentation > > fault related to the ListView when trying to delete an element in the > > ListView using the ContextMenu. I considered reporting this as a bug to > > qt.io, but I decided to post it here first. > > > > I have tried to reproduce the problem with a short code snippet, but since > > the bug needs the SQL model it was hard to get it very short. > > QML code: http://pastebin.com/b5zkFm1q > > C++ code: http://pastebin.com/5RN269kH > > gdb trace: http://pastebin.com/4ZdCbZd6 > > app debug output: http://pastebin.com/C4N9T1tP > > > > How to reproduce: > > 1. Start app (in emulator, I don't have my jolla tablet yet) > > 2. Long press the last element in the list and select "Delete" from the > > context menu. > > (It can also be triggered from other elements in the list, but the code at > > pastebin is based on the last element) > > > > The bug is triggered if the bottom of ContextMenu is rendered below the > > height of the ListView. > > When long pressing the n:th element in the ListView it will crash if: > > listviewHeight < n*elementHeight+(n-1)*spacing + contextMenuHeight > > > > Example (using pastebin code): > > ListView is 338 pixels high and have 4 items inside > > Each item is 44 pixels high > > Spacing is 1 pixel > > Context menu is 160 pixels high > > > > When clicking on the 4:th item (starting counting from 1) the total height > > of items + spacing + context menu will be: > > 4*(44) + (4-1)*1 + 160 = 339 pixels > > listviewHeight=338 => crash > > listviewHeight=339 => not crash > > > > When deleting the element in the list I do two things: > > 1. model->removeRow(index) //Everything is fine after this is executed > > 2. model->submitAll() //Results in segmentation fault > > > > I have tried replacing the model with a QML ListModel, created/filled in > > QML, but then the bug is not triggered. > > > > Any input would be appreciated! > > _______________________________________________ > > SailfishOS.org Devel mailing list > > To unsubscribe, please send a mail to > > devel-unsubscr...@lists.sailfishos.org > > _______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org