gnucash-android
gnucash-android copied to clipboard
app crashes when switching between different books if recent/favorites selected
Expected behaviour
Switch to selected book.
Actual behaviour
App crashes.
Steps to reproduce the behaviour
- Open the app.
- Swipe to recent or favorites.
- Tap on menu and switch to another book.
- Crash.
Software specifications
- GnuCash Android version: 2.1.1 beta
- System Android version: 6.0.1
- Device type: Sony Xperia Z3 compact
I'm not able to reproduce this on my device (Nexus 5, Android 6). @rivaldi8 can you reproduce this?
@codinguser: I just produced this crash and sent an error report when I was asked if I want to. Maybe that helps...
@nikopp yes, it helps. I'll be on the lookout for it. Thanks
@codinguser I'd swear I reproduced it yesterday, but I'm unable to do so now. As I keep changing branches, maybe it was with another one or under another condition.
@nikopp Are you able to reproduce it always?
@rivaldi8 No. A few weeks ago it happened all the time but now it often works several times before it crashes.
I now have a new phone and the problem is still there on a Samsung galaxy a3 with Oreo. I sent several crash reports in the past week.
The problem appeared when switching to Recent or Favorites Account Tab and then opening another Book. The problem did not appear when switching to "All" tab, then opening another book, even having open Recent or Favorites tab before "All" tab.
The Exception was thrown in DatabaseAdapter.getID() by the line : throw new IllegalArgumentException(mTableName + " with GUID " + uid + " does not exist in the db"); because the uid has been built from cursor given in AccountRecyclerAdapter.AccountsListFragment.onBindViewHolderCursor(AccountViewHolder, Cursor), which is a cursor on the previous Book and this uid does not exists in the newly opened Book.
I fixed the issue in (7b6ebb398c89459ffe479d519ee5a69db2449ae9) by removing the content of AccountsActivity.AccountViewPagerAdapter.destroyItem().
I don't know why this fixed the problem, but I found it by discovering that destroyItem() was not called when switching to "All" Tab, but was when switching to Recent or Favorites Tab.