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

[Bug]: Crash when trying to upload via image selector on first use #6131

Open
sivaraam opened this issue Jan 15, 2025 · 3 comments
Open

[Bug]: Crash when trying to upload via image selector on first use #6131

sivaraam opened this issue Jan 15, 2025 · 3 comments

Comments

@sivaraam
Copy link
Member

Summary

The app crashes when trying to do an upload using the normal file picker for the first after installation. This happens on the latest main. The second upload seems to correctly take us to the upload screen, though. We should look into fixing this as it is not a good UX to crash upon first upload.

Steps to reproduce

  1. Install the app afresh
  2. Login and try to upload using the normal photo picker
  3. Note the "Access to media" permission request shown
  4. Grant the access
  5. Observe the crash

Expected behaviour

The app should proceed to the upload screen after the permission has been granted.

Actual behaviour

The app crashes with the crash log given below.

Device name

OnePlus Nord

Android version

Android 12

Commons app version

main (does not happen in v5.1.1)

Device logs

android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:9812)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:1942)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:6233)
at android.view.View.invalidateInternal(View.java:18933)
at android.view.View.invalidate(View.java:18889)
at android.view.View.setFlags(View.java:16458)
at android.view.View.setVisibility(View.java:11971)
at fr.free.nrw.commons.upload.UploadActivity.checkStoragePermissions$lambda$7(UploadActivity.kt:302)
at fr.free.nrw.commons.upload.UploadActivity.$r8$lambda$jLDR9mwKVU8obZI0s8ZliP6txEE(Unknown Source:0)
at fr.free.nrw.commons.upload.UploadActivity$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1012)

Screen-shots

Screen recording to demonstrate the issue

Would you like to work on the issue?

None

@sonalyadav1
Copy link
Contributor

@sivaraam Taking this issue

@sonalyadav1
Copy link
Contributor

Not able to reproduce the issue in v5.1.2

@sivaraam
Copy link
Member Author

Not able to reproduce the issue in v5.1.2

I think I've mentioned that in the description itself. This issues only happens on the main branch

@nicolas-raoul nicolas-raoul added this to the 5.2.0 milestone Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants