From f76da904474645ff6eb66af3837ac8109aaf56d5 Mon Sep 17 00:00:00 2001 From: Krunal Patel Date: Mon, 28 Nov 2022 20:12:00 +0530 Subject: [PATCH] Fix wrong history deleted because of different thread --- .../com/github/libretube/ui/adapters/WatchHistoryAdapter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt index efbb50faa..1c3aa6c4e 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt @@ -21,8 +21,9 @@ class WatchHistoryAdapter( RecyclerView.Adapter() { fun removeFromWatchHistory(position: Int) { + val history = watchHistory[position] query { - DatabaseHolder.Database.watchHistoryDao().delete(watchHistory[position]) + DatabaseHolder.Database.watchHistoryDao().delete(history) } watchHistory.removeAt(position) notifyItemRemoved(position)