Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in DeckPicker after CardBrowser on clean install #4977

Closed
mikehardy opened this issue Sep 17, 2018 · 6 comments · Fixed by #4980
Closed

Crash in DeckPicker after CardBrowser on clean install #4977

mikehardy opened this issue Sep 17, 2018 · 6 comments · Fixed by #4980

Comments

@mikehardy
Copy link
Member

Reproduction Steps
  1. Clean install of current alpha, no decks
  2. Not sure if it's important, but click floating menu "get shared decks" then just back button immediately (it was in the repro and doesn't take long)
  3. Click the hamburger and select Card Browser
  4. Click the hamburger again and go to Deck list
Expected Result

You should see the Default deck and no cards

Actual Result

Crash

Debug info

This is from that same roboelectric test harness someone throws at our alphas (awesome work, that)

https://play.google.com/apps/publish/?account=5338425030304417978#PreLaunchReportPlace:p=com.ichi2.anki&appid=4973711737547064258&plrtab=CRASH&plrvc=20900135

09-17 10:13:14.046 1712-3619/system_process I/ActivityManager: START u0 {cmp=com.ichi2.anki/.CardBrowser (has extras)} from uid 10136
09-17 10:13:14.050 16163-16163/com.ichi2.anki D/DeckPicker: onPause()
09-17 10:13:14.055 16163-16163/com.ichi2.anki D/CardBrowser: onCreate()
09-17 10:13:14.067 16163-16168/com.ichi2.anki I/zygote: Do partial code cache collection, code=219KB, data=147KB
09-17 10:13:14.068 16163-16168/com.ichi2.anki I/zygote: After code cache collection, code=219KB, data=147KB
Increasing code cache capacity to 1024KB
09-17 10:13:14.083 16163-16163/com.ichi2.anki D/AnkiActivity: AnkiActivity.startLoadingCollection()
09-17 10:13:14.084 16163-16163/com.ichi2.anki D/CardBrowser: onCollectionLoaded()
09-17 10:13:14.094 16163-16182/com.ichi2.anki D/DeckTask: doInBackgroundSearchCards
09-17 10:13:14.094 16163-16163/com.ichi2.anki D/CardBrowser: onResume()
09-17 10:13:14.095 16163-16163/com.ichi2.anki D/DialogHandler: Reading persistent message
09-17 10:13:14.115 1428-1428/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
09-17 10:13:14.121 1428-1428/? I/chatty: uid=1000(system) [email protected] identical 1 line
09-17 10:13:14.125 1428-1428/? D/gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 8298496
09-17 10:13:14.155 16163-16168/com.ichi2.anki I/zygote: JIT allocated 56KB for compiled code of void android.view.View.(android.content.Context, android.util.AttributeSet, int, int)
09-17 10:13:14.166 16163-16163/com.ichi2.anki I/CardBrowser: CardBrowser:: Completed doInBackgroundSearchCards Successfuly
09-17 10:13:14.166 16163-16163/com.ichi2.anki D/AndroidRuntime: Shutting down VM

--------- beginning of crash

09-17 10:13:14.167 16163-16163/com.ichi2.anki E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ichi2.anki, PID: 16163
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.SearchView.isIconified()' on a null object reference
at com.ichi2.anki.CardBrowser$20.onPostExecute(CardBrowser.java:1364)
at com.ichi2.async.DeckTask$TaskListener.onPostExecute(DeckTask.java:1521)
at com.ichi2.async.DeckTask.onPostExecute(DeckTask.java:376)
at com.ichi2.async.DeckTask.onPostExecute(DeckTask.java:69)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

@mikehardy mikehardy self-assigned this Sep 17, 2018
@mikehardy mikehardy added this to the v2.9 release milestone Sep 17, 2018
@mikehardy
Copy link
Member Author

I'll look at this one really quickly, I note it's very late Tokyo-time...

@timrae
Copy link
Member

timrae commented Sep 17, 2018

Hmmmm are you sure this is a new bug? It seems to be caused by the decktask not respecting the lifecycle of the card browser, which is probably nothing new.

@mikehardy
Copy link
Member Author

I'm close to squishing it and I'll check 27.1.1 vs 27.0.2 support libs. I have a hunch

@timrae
Copy link
Member

timrae commented Sep 17, 2018

Also I don't think this is "high priority" yet, as I mentioned yesterday, we don't dish that award out so easily unless it's preventing a large number of users from reviewing.

mikehardy added a commit to mikehardy/Anki-Android that referenced this issue Sep 18, 2018
…4977

This may not be related to 27.0.2->27.1.1 support lib lifecycle changes,
and it may be present in other objects or have a better solution but this
fixes crash on opening CardBrowser with an empty collection
@mikehardy
Copy link
Member Author

mikehardy commented Sep 18, 2018

I've got a simple exception-handling spot-fix for it but I'm not happy with my knowledge of the interaction between onCreate() (called first) and onCreateOptionsMenu() (called after) in the whole codebase w.r.t. onCreate expecting onCreateOptionsMenu things to be initialized already, or whether this has been present forever and we just didn't know, or it was #4972

@mikehardy
Copy link
Member Author

does not affect 2.8

timrae pushed a commit that referenced this issue Sep 20, 2018
This may not be related to 27.0.2->27.1.1 support lib lifecycle changes,
and it may be present in other objects or have a better solution but this
fixes crash on opening CardBrowser with an empty collection
Apochens added a commit to Apochens/Anki-Android that referenced this issue Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants