commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
1.03k stars 1.24k forks source link

Custom selector crashes immediately when opening it #5919

Open nicolas-raoul opened 3 weeks ago

nicolas-raoul commented 3 weeks ago
STACK_TRACE=android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. Expected: main Calling: DefaultDispatcher-worker-5
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:11128)
at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:2523)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at androidx.constraintlayout.widget.ConstraintLayout.requestLayout(ConstraintLayout.java:3146)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at androidx.constraintlayout.widget.ConstraintLayout.requestLayout(ConstraintLayout.java:3146)
at android.view.View.requestLayout(View.java:28098)
at androidx.recyclerview.widget.RecyclerView.requestLayout(RecyclerView.java:4418)
at android.view.View.requestLayout(View.java:28098)
at androidx.constraintlayout.widget.ConstraintLayout.requestLayout(ConstraintLayout.java:3146)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.requestLayout(View.java:28098)
at androidx.constraintlayout.widget.ConstraintLayout.requestLayout(ConstraintLayout.java:3146)
at android.view.View.requestLayout(View.java:28098)
at android.view.View.setFlags(View.java:18393)
at android.view.View.setVisibility(View.java:13558)
at androidx.constraintlayout.widget.Group.setVisibility(Group.java:68)
at fr.free.nrw.commons.customselector.ui.adapter.ImageAdapter$ImageViewHolder.itemUploaded(ImageAdapter.kt:521)
at fr.free.nrw.commons.customselector.ui.selector.ImageLoader$queryAndSetView$1.invokeSuspend(ImageLoader.kt:215)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a7fbe9a, Dispatchers.IO]
rohit9625 commented 3 weeks ago

I think this PR will fix this.