[Android] eset previous unlock strategy

Geoffrey Métais git at videolan.org
Wed Feb 18 12:24:01 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 18 11:31:26 2015 +0100| [bb4db311f76987d426ed1fa2a189aaa3ff8fc550] | committer: Geoffrey Métais

eset previous unlock strategy

It's safer to check out of the inner loop

This reverts commit 02359fe0504f28bda98298e74333959ab74eab60.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=bb4db311f76987d426ed1fa2a189aaa3ff8fc550
---

 vlc-android/src/org/videolan/vlc/Thumbnailer.java |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/Thumbnailer.java b/vlc-android/src/org/videolan/vlc/Thumbnailer.java
index 5b1c2fb..3f74da7 100644
--- a/vlc-android/src/org/videolan/vlc/Thumbnailer.java
+++ b/vlc-android/src/org/videolan/vlc/Thumbnailer.java
@@ -149,6 +149,7 @@ public class Thumbnailer implements Runnable {
                 mVideoBrowser.resetBarrier();
             lock.lock();
             // Get the id of the file browser item to create its thumbnail.
+            boolean interrupted = false;
             while (mItems.size() == 0) {
                 try {
                     if (mVideoBrowser != null) {
@@ -158,11 +159,15 @@ public class Thumbnailer implements Runnable {
                     totalCount = 0;
                     notEmpty.await();
                 } catch (InterruptedException e) {
-                    lock.unlock();
+                    interrupted = true;
                     Log.i(TAG, "interruption probably requested by stop()");
                     break;
                 }
             }
+            if (interrupted) {
+                lock.unlock();
+                break;
+            }
             total = totalCount;
             MediaWrapper item = mItems.poll();
             lock.unlock();



More information about the Android mailing list