libre-tube / LibreTube

An alternative frontend for YouTube, for Android.
https://libretube.dev
GNU General Public License v3.0
8.74k stars 445 forks source link

LT Crashes When Removing Item From Watch History #1946

Closed akano12 closed 1 year ago

akano12 commented 1 year ago

Steps to reproduce

  1. Go to library
  2. Open watch history
  3. Try to delete an entry

Expected behavior

Remove a video from watch history

Actual behavior

App crashes and generates this log java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time. at androidx.room.RoomDatabase.assertNotMainThread(RoomDatabase.java:30) at androidx.room.RoomDatabase.beginTransaction(RoomDatabase.java:1) at com.github.libretube.db.dao.WatchHistoryDao_Impl.delete(WatchHistoryDao_Impl.java:8) at com.github.libretube.ui.adapters.WatchHistoryAdapter.removeFromWatchHistory(WatchHistoryAdapter.kt:17) at com.github.libretube.ui.adapters.WatchHistoryAdapter$$ExternalSyntheticLambda1.onClick(R8$$SyntheticClass:10) at android.view.View.performClick(View.java:7792) at android.view.View.performClickInternal(View.java:7769) at android.view.View.access$3800(View.java:910) at android.view.View$PerformClick.run(View.java:30218) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

LibreTube version

0.8.0

Android version

12

Other details

https://user-images.githubusercontent.com/50032603/202920535-b5a3d53d-ccd9-4138-b8b5-f9bda11497c8.mp4

Acknowledgements

Bnyro commented 1 year ago

1919 :)