Marc Plano-Lesay
Marc Plano-Lesay

Reputation: 6958

BlackBerry 10 Cascades app stuck affecting property

I have an issue with a list/detail pattern. I have an Article class, inheriting from QObject, defining some properties (title, updated and content being the ones that matters for now). To populate my (QML) ListView, I have a C++ GroupDataModel, filled with some Article*. Here's my list's onTriggered:

onTriggered: {
    if (indexPath.length > 1) {
        currentArticle = dataModel.data(indexPath);
        var page = articlePageDefinition.createObject();
        nav.push(page)
    }
}

As you can guess, the articlePageDefinition defines a page using the upper currentArticle property.

Now, when I display the articlePage once, it's working fine. I can go back, click on the same list item, display the same Article details, works great. But when I pick a second article, the app kind of freezes. I can go back in my navigation pane, but I can't click on list items anymore. I tried to add some logs, the onTriggered is stuck on currentArticle = dataModel.data(indexPath);. At this point, I can log every property of dataModel.data(indexPath) without any issue. I tried to not create/push the page, simply affect currentArticle and display some of its properties, it's working fine too. I really don't understand what I am doing wrong here, any help appreciated.

In case you need to see more code, everything is here: https://github.com/Kernald/tt-rss-bb10/tree/e29e3b616aa179dd42f66804ecc20a6a45b6bb22

Upvotes: 0

Views: 274

Answers (2)

Schlangi
Schlangi

Reputation: 1155

I had a similar behavior of my app, but I did not inspect your github code if the reason can be the same. I think you can verify that more quickly than me.
When removing and adding a list item with the same index, the code gets stucked. I removed an entry on user action and added a new one at that place, and it got stuck. This is a known issue to BB10, I found here: https://developer.blackberry.com/cascades/download/releasenotes/#known

Upvotes: 0

Benoit
Benoit

Reputation: 1921

Here what can cause the problem your are having:

  1. You create the articlePage and bind it's data to the "currentArticle" global variable
  2. When you go back the articlePage is not deleted.
  3. You open an other instance of this same articlePage. The last one still bind its data to the same currentArticle instance.
  4. When you go back and click another item: the previous articlePage still exists in memory. It binds to "currentArticle". The problem is, it's not the data of "currentArticle" that has changed but the object referenced by "currentArticle". The Qml binder just fails then.

Upvotes: 1

Related Questions