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

Deleting videos from history makes LibreTube crash #2177

Closed mystieneko closed 1 year ago

mystieneko commented 1 year ago

Steps to reproduce

  1. Go to video history
  2. Try to delete the video
  3. That's it

Expected behavior

The video gets deleted

Actual behavior

The app crashes

LibreTube version

0.8.0

Android version

Android 13

Other details

Error 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:7506) at android.view.View.performClickInternal(View.java:7483) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:29335) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7893) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Acknowledgements

Bnyro commented 1 year ago

Dupe of #1919