[Android] Prevent race conditions in content display

Geoffrey Métais git at videolan.org
Tue Jul 25 18:12:36 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jul 25 18:05:24 2017 +0200| [dd56db523f783b010353f73ecf13af50d25ed33c] | committer: Geoffrey Métais

Prevent race conditions in content display

> https://code.videolan.org/videolan/vlc-android/commit/dd56db523f783b010353f73ecf13af50d25ed33c
---

 vlc-android/src/org/videolan/vlc/SortableAdapter.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/SortableAdapter.java b/vlc-android/src/org/videolan/vlc/SortableAdapter.java
index aacf4e589..3265e04ee 100644
--- a/vlc-android/src/org/videolan/vlc/SortableAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/SortableAdapter.java
@@ -29,11 +29,11 @@ public abstract class SortableAdapter<T extends MediaLibraryItem, VH extends Rec
 
     public void sortBy(int sortby, int direction) {
         sMediaComparator.sortBy(sortby, direction);
-        update(new ArrayList<>(mDataset));
+        update(new ArrayList<>(peekLast()));
     }
 
     public void updateIfSortChanged() {
-        if (hasSortChanged())
+        if (!hasPendingUpdates() && hasSortChanged())
             update(new ArrayList<>(mDataset));
     }
 



More information about the Android mailing list