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 · 6 comments
Open

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

sivaraam opened this issue Jan 15, 2025 · 6 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
@sonalyadav1
Copy link
Contributor

I synced with the latest main branch and followed the steps outlined in the issue description, but I’m still unable to reproduce the crash on my device. I’ve tested with a clean installation and different scenarios, but the app behaves as expected.

@nicolas-raoul
Copy link
Member

@sonalyadav1 Perhaps it is device/etc-specific? Maybe better leave the issue to someone who happens to be able to reproduce the issue, if that's OK with you? Thanks for checking!

@sonalyadav1
Copy link
Contributor

@nicolas-raoul It’s possible that the issue is device or environment-specific, and since I’m unable to reproduce it on my setup, I’m happy to leave this issue to someone who can replicate it more reliably.

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